Aurélien Aptel schrieb am Do., 15. Okt. 2015 um 01:48 Uhr: > On Thu, Oct 15, 2015 at 12:25 AM, Philipp Stephani > wrote: > > static Lisp_Object value_to_lisp (emacs_value value) { > > return value->v; > > } > > > > static emacs_value lisp_to_value (Lisp_Object object) { > > emacs_value v = (emacs_value) malloc(sizeof v); > > // The allocation needs to be smarter, this example leaks memory. > > if (!v) return 0; > > v->v = object; > > return v; > > } > > I'm not a big fan of a dynamically allocating memory for each > conversion, it's too expensive. Daniel solution seems more manageable. > Agreed. I've implemented Daniel's suggestion on the tls-error branch, it seems to work fine (but note that environments are now no longer global, so storing away emacs_values without global references now will lead to undefined behavior). > > By the way, I've merged your tls-errors branch in mine. Cool, thanks! > But the API > doesn't have an unsafe funcall iiuc. That's fine with me but Stefan > was insistent on that. > Let's see what will get accepted upstream.