Trading API for C
7.0.0.309536
|
Functions | |
void * | ctl_calloc (size_t nmemb, size_t size) |
Allocate and zero an array of elements. More... | |
void | ctl_free (void *block) |
Free the supplied memory block. More... | |
void * | ctl_malloc (size_t size) |
Allocate a chunk of memory. More... | |
void * | ctl_realloc (void *orig, size_t size) |
Reallocate the supplied memory. More... | |
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. More... | |
char * | ctl_strdup (const char *orig) |
Duplicate the supplied string. More... | |
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 |
By default the library will use the standard library allocation functions, you can use this function to redirect all memory usage by the library to a custom implementation. If you wish to use this functionality then you MUST call this function prior to any other calls into the Trading API.
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 |
This function will use the allocation routines set using sl_set_allocator() to duplicate the supplied string