![]() |
ucx
UAP Common Extensions
|
Defines a reallocation mechanism for arrays. More...
#include <array_list.h>
Data Fields | |
| void *(* | realloc )(void *array, size_t old_capacity, size_t new_capacity, size_t elem_size, struct cx_array_reallocator_s *alloc) |
| Reallocates space for the given array. | |
| const CxAllocator * | allocator |
| The allocator that shall be used for the reallocations. | |
| const void * | stack_ptr |
| Optional pointer to stack memory if the array is originally located on the stack. | |
Defines a reallocation mechanism for arrays.
You can create your own, use cx_array_reallocator(), or use the cx_array_default_reallocator.
| void *(* cx_array_reallocator_s::realloc) (void *array, size_t old_capacity, size_t new_capacity, size_t elem_size, struct cx_array_reallocator_s *alloc) |
Reallocates space for the given array.
Implementations are not required to free the original array. This allows reallocation of static or stack memory by allocating heap memory and copying the array contents; namely when stack_ptr in this struct is not NULL and array equals stack_ptr.
| array | the array to reallocate |
| old_capacity | the old number of elements |
| new_capacity | the new number of elements |
| elem_size | the size of each element |
| alloc | a reference to this allocator |
NULL on failure