1
2
3
4
5
6
7
8
9gd_alloc_funcs(3)                   GETDATA                  gd_alloc_funcs(3)
10
11
12

NAME

14       gd_alloc_funcs — specify an alternate memory manager for GetData's use
15
16

SYNOPSIS

18       #include <getdata.h>
19
20       void gd_alloc_funcs(void *(*malloc_func)(size_t), void
21              (*free_func)(void*));
22
23

DESCRIPTION

25       The gd_alloc_funcs() allows the caller to specify an  alternate  memory
26       manager for GetData to use when providing dynamically allocated data to
27       the caller.  The caller should specify pointers to two functions  which
28       mimic  the  behaviour  of  the Standard Library's malloc(3) and free(3)
29       functions.  Passing NULL is equivalent to passing a pointer to the cor‐
30       responding Standard Library function, so the default memory manager can
31       be restored by passing all NULLs to this function.
32
33       The functions gd_entry(3), gd_error_string(3),  gd_fragment_affixes(3),
34       gd_linterp_tablename(3),  gd_raw_filename(3), and gd_strtok(3) will use
35       malloc_func  to  allocate  the  buffers  they  return.   The   function
36       gd_free_entry_strings(3) will use the specified free_func to deallocate
37       entry strings, and that same function will also be used by  GetData  to
38       deallocate  strings returned by any registered parser callback function
39       (see gd_cbopen(3)).
40
41       Internally, GetData may still allocate buffers on a different heap, and
42       the caller should not assume that any other pointer returned by the li‐
43       brary were allocated with the functions  specified  by  this  function.
44       Neither  should the caller assume that these functions won't be used by
45       GetData library functions to allocate and deallocate temporary buffers.
46
47       Changes made to the memory manager  are  global  across  GetData.   The
48       caller should only call this function when it is certain that no object
49       allocated with the old memory manager still exists.
50
51       This function always succeeds and returns no value.
52
53

HISTORY

55       The gd_alloc_funcs() function appeared in GetData-0.10.0.
56
57

SEE ALSO

59       free(3),      gd_cbopen(3),      gd_entry(3),       gd_error_string(3),
60       gd_fragment_affixes(3),                        gd_free_entry_strings(3)
61       gd_linterp_tablename(3), gd_raw_filename(3), gd_strtok(3), malloc(3)
62
63
64
65Version 0.10.0                 25 December 2016              gd_alloc_funcs(3)
Impressum