IIUC if we want tree-sitter to use our malloc, we need to build it with Emacs, where should I put the source of tree-sitter?
tree-sitter itself should be a library we link against. If you meantthe tree-sitter support code, then it should go on a separate file insrc/. Or did I misunderstand your question?
If we link against libtree-sitter, how do we change its malloc behavior? Tree-sitter has these kind of things:
#ifndef ts_malloc
#define ts_malloc ts_malloc_default
#endif
So I assume we need to define ts_malloc to, say, xmalloc when compiling libtree-sitter. And if we only link to it, we can’t redefine ts_malloc.
Yuan