Paul Eggert <egg...@cs.ucla.edu> writes: > But that raises another problem. For Emacs, I'd like a variant of > vasnprintf that uses Emacs's allocators rather than malloc/realloc/free. > I could instead attack the problem by blocking interrupts while > calling vasnprintf, but I'd rather not add these extra system calls > for every call to vasnprintf. > > I expect that I can do that by creating a new module (vcasnprintf, say), > which defines a function that acts like vasnprintf but allocates > storage as specified by a struct allocator parameter. The best way > to do that, I expect, would be to refactor vasnprintf.c, and I am > thinking of proposing something along those lines.
Couldn't you just call the existing *printf functions and reallocate the output using Emacs' strdup or similar? There will be a slight performance hit, but I wonder if it matters compared to the cost if maintaining *printf functions that differs even more from glibc. /Simon