Debian Codegraph @

Xtree-house/bindings/vendor/src/alloc.h

raw
1 #ifndef TREE_SITTER_ALLOC_H_
2 #define TREE_SITTER_ALLOC_H_
3
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
7
8 #include <stdbool.h>
9 #include <stdio.h>
10 #include <stdlib.h>
11
12 #if defined(TREE_SITTER_HIDDEN_SYMBOLS) || defined(_WIN32)
13 #define TS_PUBLIC
14 #else
15 #define TS_PUBLIC __attribute__((visibility("default")))
16 #endif
17
18 TS_PUBLIC extern void *(*ts_current_malloc)(size_t size);
19 TS_PUBLIC extern void *(*ts_current_calloc)(size_t count, size_t size);
20 TS_PUBLIC extern void *(*ts_current_realloc)(void *ptr, size_t size);
21 TS_PUBLIC extern void (*ts_current_free)(void *ptr);
22
23 // Allow clients to override allocation functions
24 #ifndef ts_malloc
25 #define ts_malloc ts_current_malloc
26 #endif
27 #ifndef ts_calloc
28 #define ts_calloc ts_current_calloc
29 #endif
30 #ifndef ts_realloc
31 #define ts_realloc ts_current_realloc
32 #endif
33 #ifndef ts_free
34 #define ts_free ts_current_free
35 #endif
36
37 #ifdef __cplusplus
38 }
39 #endif
40
41 #endif // TREE_SITTER_ALLOC_H_