ucx
UAP Common Extensions
Loading...
Searching...
No Matches
Data Fields
cx_array_reallocator_s Struct Reference

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.
 

Detailed Description

Defines a reallocation mechanism for arrays.

You can create your own, use cx_array_reallocator(), or use the cx_array_default_reallocator.

Field Documentation

◆ realloc

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.

Parameters
arraythe array to reallocate
capacitythe new capacity (number of elements)
elem_sizethe size of each element
alloca reference to this allocator
Returns
a pointer to the reallocated memory or NULL on failure

The documentation for this struct was generated from the following file: