This is the mail archive of the
mailing list for the glibc project.
Re: [PATCH] libio: Add small optimization on fmemopen
On 21/09/2016 11:57, Florian Weimer wrote:
> On 09/21/2016 04:05 PM, Adhemerval Zanella wrote:
>> This patch uses C99 variable-lenght array on internal fmemopen cookie
>> allocation to avoid to use two mallocs for the case if an internal
>> buffer must be allocated. No functional changes are done.
>> Tested on x86_64 and i686.
>> * libio/fmemopen.c (fmemopen_cookie_t): Remove mybuffer and add
>> variable-length array member.
>> (fmemopen_close): Do no free the internal buffer.
>> (__fmemopen): Use C99 variable-length array to allocate both the
>> fmemopen cookie and internal buffer (for null arguments).
> It's a flexible array member, not a variable-length array. Looks good to me.
Right, I will correct naming in commit message.
> What about libio/oldfmemopen.c? Do you want to touch this as well?
I won't bother with it, testing would be tricky and I do not see a
compelling reason to optimize compat code.