Rizin
unix-like reverse engineering framework and cli tools
|
Go to the source code of this file.
Functions | |
static void * | ts_malloc_default (size_t size) |
static void * | ts_calloc_default (size_t count, size_t size) |
static void * | ts_realloc_default (void *buffer, size_t size) |
void | ts_set_allocator (void *(*new_malloc)(size_t), void *(*new_calloc)(size_t, size_t), void *(*new_realloc)(void *, size_t), void(*new_free)(void *)) |
Variables | |
void *(* | ts_current_malloc )(size_t) = ts_malloc_default |
void *(* | ts_current_calloc )(size_t, size_t) = ts_calloc_default |
void *(* | ts_current_realloc )(void *, size_t) = ts_realloc_default |
void(* | ts_current_free )(void *) = free |
Definition at line 13 of file alloc.c.
References calloc(), count, and test-lz4-list::exit.
Referenced by ts_set_allocator().
|
static |
Definition at line 4 of file alloc.c.
References test-lz4-list::exit, and malloc().
Referenced by ts_set_allocator().
|
static |
Definition at line 22 of file alloc.c.
References test-lz4-list::exit, and realloc().
Referenced by ts_set_allocator().
void ts_set_allocator | ( | void *(*)(size_t) | new_malloc, |
void *(*)(size_t, size_t) | new_calloc, | ||
void *(*)(void *, size_t) | new_realloc, | ||
void(*)(void *) | new_free | ||
) |
Set the allocation functions used by the library.
By default, Tree-sitter uses the standard libc allocation functions, but aborts the process when an allocation fails. This function lets you supply alternative allocation functions at runtime.
If you pass NULL
for any parameter, Tree-sitter will switch back to its default implementation of that function.
If you call this function after the library has already been used, then you must ensure that either:
Definition at line 37 of file alloc.c.
References free(), ts_calloc_default(), ts_current_calloc, ts_current_free, ts_current_malloc, ts_current_realloc, ts_malloc_default(), and ts_realloc_default().
void*(* ts_current_calloc) (size_t, size_t) | ( | size_t | , |
size_t | |||
) | = ts_calloc_default |
Definition at line 33 of file alloc.c.
Referenced by ts_set_allocator().
void(* ts_current_free) (void *) | ( | void * | ) | = free |
Definition at line 35 of file alloc.c.
Referenced by ts_set_allocator().
void*(* ts_current_malloc) (size_t) | ( | size_t | ) | = ts_malloc_default |
Definition at line 32 of file alloc.c.
Referenced by ts_set_allocator().
void*(* ts_current_realloc) (void *, size_t) | ( | void * | , |
size_t | |||
) | = ts_realloc_default |
Definition at line 34 of file alloc.c.
Referenced by ts_set_allocator().