plum
git clone https://git.pyrossh.dev/plum
A statically typed, imperative programming language inspired by rust, python
plum-tooling/tree-sitter-plum/src/tree_sitter/alloc.h
| 5d12d71 | 1 | #ifndef TREE_SITTER_ALLOC_H_ |
| 5d12d71 | 2 | #define TREE_SITTER_ALLOC_H_ |
| 5d12d71 | 3 | |
| 5d12d71 | 4 | #ifdef __cplusplus |
| 5d12d71 | 5 | extern "C" { |
| 5d12d71 | 6 | #endif |
| 5d12d71 | 7 | |
| 5d12d71 | 8 | #include <stdbool.h> |
| 5d12d71 | 9 | #include <stdio.h> |
| 5d12d71 | 10 | #include <stdlib.h> |
| 5d12d71 | 11 | |
| 5d12d71 | 12 | // Allow clients to override allocation functions |
| 5d12d71 | 13 | #ifdef TREE_SITTER_REUSE_ALLOCATOR |
| 5d12d71 | 14 | |
| 0d43379 | 15 | extern void *(*ts_current_malloc)(size_t size); |
| 0d43379 | 16 | extern void *(*ts_current_calloc)(size_t count, size_t size); |
| 0d43379 | 17 | extern void *(*ts_current_realloc)(void *ptr, size_t size); |
| 0d43379 | 18 | extern void (*ts_current_free)(void *ptr); |
| 5d12d71 | 19 | |
| 5d12d71 | 20 | #ifndef ts_malloc |
| 5d12d71 | 21 | #define ts_malloc ts_current_malloc |
| 5d12d71 | 22 | #endif |
| 5d12d71 | 23 | #ifndef ts_calloc |
| 5d12d71 | 24 | #define ts_calloc ts_current_calloc |
| 5d12d71 | 25 | #endif |
| 5d12d71 | 26 | #ifndef ts_realloc |
| 5d12d71 | 27 | #define ts_realloc ts_current_realloc |
| 5d12d71 | 28 | #endif |
| 5d12d71 | 29 | #ifndef ts_free |
| 5d12d71 | 30 | #define ts_free ts_current_free |
| 5d12d71 | 31 | #endif |
| 5d12d71 | 32 | |
| 5d12d71 | 33 | #else |
| 5d12d71 | 34 | |
| 5d12d71 | 35 | #ifndef ts_malloc |
| 5d12d71 | 36 | #define ts_malloc malloc |
| 5d12d71 | 37 | #endif |
| 5d12d71 | 38 | #ifndef ts_calloc |
| 5d12d71 | 39 | #define ts_calloc calloc |
| 5d12d71 | 40 | #endif |
| 5d12d71 | 41 | #ifndef ts_realloc |
| 5d12d71 | 42 | #define ts_realloc realloc |
| 5d12d71 | 43 | #endif |
| 5d12d71 | 44 | #ifndef ts_free |
| 5d12d71 | 45 | #define ts_free free |
| 5d12d71 | 46 | #endif |
| 5d12d71 | 47 | |
| 5d12d71 | 48 | #endif |
| 5d12d71 | 49 | |
| 5d12d71 | 50 | #ifdef __cplusplus |
| 5d12d71 | 51 | } |
| 5d12d71 | 52 | #endif |
| 5d12d71 | 53 | |
| 5d12d71 | 54 | #endif // TREE_SITTER_ALLOC_H_ |