gd_alloc_funcs(3)

NAME
gd_alloc_funcs — specify an alternate memory manager for GetData's use

SYNOPSIS
#include <getdata.h>

void gd_alloc_funcs(void *(*malloc_func)(size_t), void (*free_func)(void*));

DESCRIPTION
The function 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 and 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 and will use to allocate the buffers they return. The function will use the specified 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

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.

HISTORY
The function appeared in GetData-0.10.0.

SEE ALSO