![]() |
ucx
UAP Common Extensions
|
Defines a reallocation mechanism for arrays. More...
#include <array_list.h>
Data Fields | |
void *(* | realloc )(void *array, size_t capacity, size_t elem_size, struct cx_array_reallocator_s *alloc) |
Reallocates space for the given array. | |
void * | ptr1 |
Custom data pointer. | |
void * | ptr2 |
Custom data pointer. | |
size_t | int1 |
Custom data integer. | |
size_t | int2 |
Custom data integer. | |
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 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 memory by allocating heap memory and copying the array contents. The information in the custom fields of the referenced allocator can be used to track the state of the memory or to transport other additional data.
array | the array to reallocate |
capacity | the new capacity (number of elements) |
elem_size | the size of each element |
alloc | a reference to this allocator |
NULL
on failure