infix
A JIT-Powered FFI Library for C
Loading...
Searching...
No Matches
allocator.c
Go to the documentation of this file.
1
21#include <stdlib.h>
22
23infix_allocator_t infix_allocator = {malloc, calloc, realloc, free};
24
25void infix_set_allocator(const infix_allocator_t * allocator) {
26 if (allocator) {
27 infix_allocator = *allocator;
28 }
29 else {
30 infix_allocator.malloc = malloc;
31 infix_allocator.calloc = calloc;
32 infix_allocator.realloc = realloc;
34 }
35}
free(defs)
void *(* malloc)(size_t)
Definition infix.h:376
void *(* calloc)(size_t, size_t)
Definition infix.h:377
void(* free)(void *)
Definition infix.h:379
void *(* realloc)(void *, size_t)
Definition infix.h:378
infix_allocator_t infix_allocator
The allocator currently used for all of infix's internal heap allocations.
Definition allocator.c:23
void infix_set_allocator(const infix_allocator_t *allocator)
Replaces the allocator infix uses for all internal heap allocations.
Definition allocator.c:25
Internal data structures, function prototypes, and constants.
Definition infix.h:375