[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: vsnprintf unnecessarily configures and builds vasnprintf.o etc.
From: |
Simon Josefsson |
Subject: |
Re: vsnprintf unnecessarily configures and builds vasnprintf.o etc. |
Date: |
Fri, 08 Apr 2011 11:58:39 +0200 |
User-agent: |
Gnus/5.110016 (No Gnus v0.16) Emacs/23.2 (gnu/linux) |
Paul Eggert <address@hidden> 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