diff options
| author | 2021-04-29 15:58:41 -0500 | |
|---|---|---|
| committer | 2021-04-29 15:58:41 -0500 | |
| commit | 49f66a936ccc45c9606a2e68757ccbdaa4f71685 (patch) | |
| tree | 6da5011d6b541a4a52d82b7b3f0efc055620f8f9 /src/include/janet.h | |
| parent | Update jpm to work post patch. (diff) | |
| parent | Add config support for custom allocators. (diff) | |
Merge commit 'f4c9064b79d5b32fd74e5ddf25266356c22dd53b'
Diffstat (limited to 'src/include/janet.h')
| -rw-r--r-- | src/include/janet.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/include/janet.h b/src/include/janet.h index e5a6b8e7..0b41987c 100644 --- a/src/include/janet.h +++ b/src/include/janet.h @@ -1892,6 +1892,24 @@ JANET_API JanetThread *janet_thread_current(void); #endif +/* Custom allocator support */ +JANET_API void *(janet_malloc)(size_t); +JANET_API void *(janet_realloc)(void *, size_t); +JANET_API void *(janet_calloc)(size_t, size_t); +JANET_API void (janet_free)(void *); +#ifndef janet_malloc +#define janet_malloc(X) malloc((X)) +#endif +#ifndef janet_realloc +#define janet_realloc(X, Y) realloc((X), (Y)) +#endif +#ifndef janet_calloc +#define janet_calloc(X, Y) calloc((X), (Y)) +#endif +#ifndef janet_free +#define janet_free(X) free((X)) +#endif + /***** END SECTION MAIN *****/ /* Re-enable popped variable length array warnings */ |
