30#define bj_array_new_t(T) bj_array_new(sizeof(T))
General-purpose definitions for Banjo API.
void bj_array_set_len(bj_array *array, size_t len)
Resizes the array to the specified length.
void * bj_array_data(const bj_array *array)
Retrieves a pointer to the underlying data of the array.
bj_array * bj_array_new(size_t bytes_payload)
Creates a new bj_array with a payload size specified in bytes.
struct bj_array_t bj_array
Typedef for the bj_array_t struct.
Definition array.h:21
void bj_array_clear(bj_array *array)
Clears all elements in the array.
void bj_array_push(bj_array *array, const void *value)
Appends a value to the end of the array.
size_t bj_array_capacity(const bj_array *array)
Retrieves the current capacity of the array.
bj_array * bj_array_alloc(void)
Allocate enough memory to hold an Array object.
bj_array * bj_array_init(bj_array *p_instance, size_t bytes_payload)
Initialize a new array with given size.
void bj_array_reserve(bj_array *array, size_t capacity)
Reserves memory for up to capacity elements in the array.
size_t bj_array_len(const bj_array *array)
Retrieves the number of elements in the array.
void bj_array_shrink(bj_array *array)
Shrinks the memory allocation to fit the current array length.
void bj_array_reset(bj_array *p_array)
Resets the entire array object, making it suitable for free.
void * bj_array_at(const bj_array *array, size_t at)
Retrieves the value stored at the specified index in the array.
void bj_array_pop(bj_array *array)
Removes the last value from the array.
void bj_array_del(bj_array *p_array)
Deletes a bj_array object and releases associated memory.