tree-sitter/lib/src/alloc.h
2021-12-18 09:53:58 +08:00

36 lines
639 B
C

#ifndef TREE_SITTER_ALLOC_H_
#define TREE_SITTER_ALLOC_H_
#include "tree_sitter/api.h"
#ifdef __cplusplus
extern "C" {
#endif
#include <stdlib.h>
#include <stdbool.h>
#include <stdio.h>
extern TSAllocator *ts_allocator;
// Allow clients to override allocation functions
#ifndef ts_malloc
#define ts_malloc ts_allocator->malloc
#endif
#ifndef ts_calloc
#define ts_calloc ts_allocator->calloc
#endif
#ifndef ts_realloc
#define ts_realloc ts_allocator->realloc
#endif
#ifndef ts_free
#define ts_free ts_allocator->free
#endif
bool ts_toggle_allocation_recording(bool);
#ifdef __cplusplus
}
#endif
#endif // TREE_SITTER_ALLOC_H_