12#ifndef __WMEM_ARRAY_H__
13#define __WMEM_ARRAY_H__
121#define wmem_array_append_one(ARRAY, VAL) \
122 wmem_array_append((ARRAY), &(VAL), 1)
WS_DLL_PUBLIC wmem_allocator_t * wmem_array_get_allocator(const wmem_array_t *array)
Retrieve the memory allocator associated with a dynamic array.
Definition wmem_array.c:165
WS_DLL_PUBLIC wmem_array_t * wmem_array_sized_new(wmem_allocator_t *allocator, size_t elem_size, unsigned alloc_count) G_GNUC_MALLOC
Create a new dynamically sized array with a specified element size and initial capacity.
Definition wmem_array.c:41
WS_DLL_PUBLIC void wmem_destroy_array(wmem_array_t *array)
Destroy a dynamic array and free its associated memory.
Definition wmem_array.c:188
WS_DLL_PUBLIC void * wmem_array_index(const wmem_array_t *array, unsigned array_index)
Retrieve a pointer to an element in a dynamic array by index.
Definition wmem_array.c:128
WS_DLL_PUBLIC void wmem_array_bzero(wmem_array_t *array)
Zero out the contents of a dynamic array.
Definition wmem_array.c:109
WS_DLL_PUBLIC unsigned wmem_array_get_count(const wmem_array_t *array)
Get the number of elements currently stored in a dynamic array.
Definition wmem_array.c:156
WS_DLL_PUBLIC void * wmem_array_get_raw(const wmem_array_t *array)
Retrieve a raw pointer to the internal buffer of a dynamic array.
Definition wmem_array.c:150
WS_DLL_PUBLIC void wmem_array_grow(wmem_array_t *array, const unsigned to_add)
Increase the capacity of a dynamic array by a specified number of elements.
Definition wmem_array.c:71
WS_DLL_PUBLIC int wmem_array_try_index(const wmem_array_t *array, unsigned array_index, void *val)
Safely retrieve an element from a dynamic array by index.
Definition wmem_array.c:135
WS_DLL_PUBLIC void wmem_array_sort(wmem_array_t *array, int(*compar)(const void *, const void *))
Sort the elements of a dynamic array.
Definition wmem_array.c:144
WS_DLL_PUBLIC wmem_array_t * wmem_array_new(wmem_allocator_t *allocator, const size_t elem_size) G_GNUC_MALLOC
Create a new dynamically sized array with default initial capacity.
Definition wmem_array.c:61
WS_DLL_PUBLIC void wmem_array_set_null_terminator(wmem_array_t *array)
Set a null terminator at the end of a dynamic array.
Definition wmem_array.c:102
WS_DLL_PUBLIC void * wmem_array_finalize(wmem_array_t *array)
Finalize a dynamic array and retrieve its underlying buffer.
Definition wmem_array.c:174
WS_DLL_PUBLIC void wmem_array_append(wmem_array_t *array, const void *in, unsigned count)
Append elements to a dynamic array.
Definition wmem_array.c:115
Definition wmem_allocator.h:27
Definition wmem_array.c:27