bindrv_setalloc
bindrv_setalloc |
Purpose
Synopsis
void bindrv_setalloc(s_bindrvctx bctx, void* (*memalloc)(size_t,void*), void* mctx);
Arguments
bctx
|
A BinDrv reader context
|
memalloc
|
A memory allocator or
NULL
|
mctx
|
Context to be passed as the last argument of
mamalloc
|
Further information
1. When reading a string, the function
bindrv_getstring allocates a buffer that it returns. By default the C function
malloc is used for this memory allocation. This routine allows to set an alternative function for this task: the provided function takes as argument the size of the buffer to allocate as well as some context pointer
mctx.
2. Using
NULL as the function pointer restores the default memory allocator, namely the C function
malloc.
Related topics