bug-gnulib
[Top][All Lists]
Advanced

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

Re: [PATCH] areadlink-with-size: guess a buffer size with 0 size


From: Paul Eggert
Subject: Re: [PATCH] areadlink-with-size: guess a buffer size with 0 size
Date: Sat, 6 Jul 2019 19:28:23 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2

Pádraig Brady wrote:
Your patch has the advantage of allocating the exact right sized buffer
in the usual case, but the disadvantage of CPU overhead in string length 
determination,
and some extra code complexity in the separate small buffer handling.

I think the code complexity is worth it, to avoid calling realloc in the typical case when the size is not known. The string length determination can easily be avoided, so I installed the attached which does that.

Attachment: 0001-areadlink-with-size-avoid-realloc-when-size-0.patch
Description: Text Data


reply via email to

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