Functions | |
void | ctl_set_allocator (void *(*realloc_func)(void *ctx, void *orig, size_t size), void(*free_func)(void *ctx, void *), void *ctx) |
Set the allocator that will be used by the library. | |
char * | ctl_strdup (const char *orig) |
Duplicate the supplied string. | |
void * | ctl_calloc (size_t nmemb, size_t size) |
Allocate and zero an array of elements. | |
void * | ctl_malloc (size_t size) |
Allocate a chunk of memory. | |
void * | ctl_realloc (void *orig, size_t size) |
Reallocate the supplied memory. | |
void | ctl_free (void *block) |
Free the supplied memory block. |
void* ctl_calloc | ( | size_t | nmemb, | |
size_t | size | |||
) |
Allocate and zero an array of elements.
nmemb | - Number of elements | |
size | - Size of each element |
void ctl_free | ( | void * | block | ) |
Free the supplied memory block.
block | - Memory block to release |
void* ctl_malloc | ( | size_t | size | ) |
Allocate a chunk of memory.
size | - Amount of memory to allocate |
void* ctl_realloc | ( | void * | orig, | |
size_t | size | |||
) |
Reallocate the supplied memory.
orig | - The original memory block (may be NULL) | |
size | - New size of the memory block |
void ctl_set_allocator | ( | void *(*)(void *ctx, void *orig, size_t size) | realloc_func, | |
void(*)(void *ctx, void *) | free_func, | |||
void * | ctx | |||
) |
Set the allocator that will be used by the library.
realloc_func | - Function for realloc() - this function MUST accept NULL as the original block parameter | |
free_func | - Function for free() | |
ctx | - User specified context that will be supplied to the allocator calls |
The ctx parameter can be used to hold a reference to your memory pool/arena.
char* ctl_strdup | ( | const char * | orig | ) |
Duplicate the supplied string.
orig | - The string to duplicate |