aboutsummaryrefslogtreecommitdiff
path: root/vendor/tree-sitter/lib/src/alloc.h
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/tree-sitter/lib/src/alloc.h')
-rw-r--r--vendor/tree-sitter/lib/src/alloc.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/vendor/tree-sitter/lib/src/alloc.h b/vendor/tree-sitter/lib/src/alloc.h
new file mode 100644
index 0000000..c51f84a
--- /dev/null
+++ b/vendor/tree-sitter/lib/src/alloc.h
@@ -0,0 +1,37 @@
1#ifndef TREE_SITTER_ALLOC_H_
2#define TREE_SITTER_ALLOC_H_
3
4#include "tree_sitter/api.h"
5
6#ifdef __cplusplus
7extern "C" {
8#endif
9
10#include <stdlib.h>
11#include <stdbool.h>
12#include <stdio.h>
13
14extern void *(*ts_current_malloc)(size_t);
15extern void *(*ts_current_calloc)(size_t, size_t);
16extern void *(*ts_current_realloc)(void *, size_t);
17extern void (*ts_current_free)(void *);
18
19// Allow clients to override allocation functions
20#ifndef ts_malloc
21#define ts_malloc ts_current_malloc
22#endif
23#ifndef ts_calloc
24#define ts_calloc ts_current_calloc
25#endif
26#ifndef ts_realloc
27#define ts_realloc ts_current_realloc
28#endif
29#ifndef ts_free
30#define ts_free ts_current_free
31#endif
32
33#ifdef __cplusplus
34}
35#endif
36
37#endif // TREE_SITTER_ALLOC_H_