Provided by: libgetdata-doc_0.10.0-5build2_all
gd_alloc_funcs — specify an alternate memory manager for GetData's use
#include <getdata.h> void gd_alloc_funcs(void *(*malloc_func)(size_t), void (*free_func)(void*));
The gd_alloc_funcs() allows the caller to specify an alternate memory manager for GetData to use when providing dynamically allocated data to the caller. The caller should specify pointers to two functions which mimic the behaviour of the Standard Library's malloc(3) and free(3) functions. Passing NULL is equivalent to passing a pointer to the corresponding Standard Library function, so the default memory manager can be restored by passing all NULLs to this function. The functions gd_entry(3), gd_error_string(3), gd_fragment_affixes(3), gd_linterp_tablename(3), gd_raw_filename(3), and gd_strtok(3) will use malloc_func to allocate the buffers they return. The function gd_free_entry_strings(3) will use the specified free_func to deallocate entry strings, and that same function will also be used by GetData to deallocate strings returned by any registered parser callback function (see gd_cbopen(3)). Internally, GetData may still allocate buffers on a different heap, and the caller should not assume that any other pointer returned by the library were allocated with the functions specified by this function. Neither should the caller assume that these functions won't be used by GetData library functions to allocate and deallocate temporary buffers. Changes made to the memory manager are global across GetData. The caller should only call this function when it is certain that no object allocated with the old memory manager still exists. This function always succeeds and returns no value.
The gd_alloc_funcs() function appeared in GetData-0.10.0.
free(3), gd_cbopen(3), gd_entry(3), gd_error_string(3), gd_fragment_affixes(3), gd_free_entry_strings(3) gd_linterp_tablename(3), gd_raw_filename(3), gd_strtok(3), malloc(3)