mirror of
https://github.com/neovim/neovim.git
synced 2024-12-25 13:45:15 -07:00
Merge pull request #17006 from vigoux/tree-sitter-alloc
feat(treesitter): set allocator when possible
This commit is contained in:
commit
2818de8b76
@ -408,6 +408,19 @@ main(void)
|
||||
if(TS_HAS_SET_MATCH_LIMIT)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DNVIM_TS_HAS_SET_MATCH_LIMIT")
|
||||
endif()
|
||||
check_c_source_compiles("
|
||||
#include <stdlib.h>
|
||||
#include <tree_sitter/api.h>
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
ts_set_allocator(malloc, calloc, realloc, free);
|
||||
return 0;
|
||||
}
|
||||
" TS_HAS_SET_ALLOCATOR)
|
||||
if(TS_HAS_SET_ALLOCATOR)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DNVIM_TS_HAS_SET_ALLOCATOR")
|
||||
endif()
|
||||
|
||||
# Note: The test lib requires LuaJIT; it will be skipped if LuaJIT is missing.
|
||||
option(PREFER_LUA "Prefer Lua over LuaJIT in the nvim executable." OFF)
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user