CYAML Internals
|
CYAML memory allocation handling. More...
Macros | |
#define | CYAML_UNUSED(_x) ((void)(_x)) |
Functions | |
void * | cyaml_mem (void *ctx, void *ptr, size_t size) |
CYAML memory allocation handling.
#define CYAML_UNUSED | ( | _x | ) | ((void)(_x)) |
Macro to squash unused variable compiler warnings.
void* cyaml_mem | ( | void * | ctx, |
void * | ptr, | ||
size_t | size | ||
) |
CYAML default memory allocation / freeing function.
This is used when clients don't supply their own. It is exposed to enable clients to use the same allocator as libcyaml used internally to allocate/free memory when they have not provided their own allocation function.
[in] | ctx | Allocation context, unused. |
[in] | ptr | Existing allocation to resize, or NULL. |
[in] | size | The new size for the allocation. |
size == 0
this frees ptr
. size == 0
, returns NULL. If size > 0
, returns NULL on failure, and any existing allocation is left untouched, or return non-NULL as the new allocation on success, and the original pointer becomes invalid.