emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to add pseudo vector types


From: Eli Zaretskii
Subject: Re: How to add pseudo vector types
Date: Sat, 24 Jul 2021 20:46:38 +0300

> From: Yuan Fu <casouri@gmail.com>
> Date: Sat, 24 Jul 2021 13:40:28 -0400
> Cc: Stefan Monnier <monnier@iro.umontreal.ca>,
>  Clément Pit-Claudel <cpitclaudel@gmail.com>,
>  emacs-devel@gnu.org
> 
>  How does TS propose the client projects to do that?  Are you saying
>  that the only way to replace its malloc is to recompile tree-sitter??
> 
> Here is the relevant lines in alloc.h in tree-sitter:
> 
> // Allow clients to override allocation functions
> 
> #ifndef ts_malloc
> #define ts_malloc  ts_malloc_default
> #endif
> #ifndef ts_calloc
> #define ts_calloc  ts_calloc_default
> #endif
> #ifndef ts_realloc
> #define ts_realloc ts_realloc_default
> #endif
> #ifndef ts_free
> #define ts_free    ts_free_default
> #endif
> 
> I’m not a C expert, does this allow us to replace its malloc in runtime?

No, not AFAIU.  It only allows to make such changes when TS is
compiled.

We should ask the TS developers to provide a way of specifying custom
memory allocation/release function as part of TS initialization.  It
is a feature many packages provide.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]