From b1e0aa60f9a0c17084de07871d507576869b9559 Mon Sep 17 00:00:00 2001 From: Thomas Vigouroux Date: Sun, 9 Jan 2022 10:13:49 +0000 Subject: feat(treesitter): set allocator when possible Adds a new cmake check to keep this backwards compatible with the different versions of tree-sitter. --- src/nvim/lua/treesitter.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/nvim/lua/treesitter.c b/src/nvim/lua/treesitter.c index 60a000843f..f4067ad02f 100644 --- a/src/nvim/lua/treesitter.c +++ b/src/nvim/lua/treesitter.c @@ -129,6 +129,10 @@ void tslua_init(lua_State *L) build_meta(L, TS_META_QUERY, query_meta); build_meta(L, TS_META_QUERYCURSOR, querycursor_meta); build_meta(L, TS_META_TREECURSOR, treecursor_meta); + +#ifdef NVIM_TS_HAS_SET_ALLOCATOR + ts_set_allocator(xmalloc, xcalloc, xrealloc, xfree); +#endif } int tslua_has_language(lua_State *L) -- cgit