Pádraig Brady wrote:
> On 04/19/2012 12:15 PM, Jim Meyering wrote:
>> strncpy is particularly bad, but even strcpy is best avoided.
>
> Yep, strncpy may not NUL terminate,
> so using it is awkward as detailed here:
> http://www.pixelbeat.org/programming/gcc/string_buffers.html
>
> stpcpy/stpncpy are appropriate here as the buffer is just
> the right size, so you don't waste cycles filling with NULs etc.
>
> Often it's simpler/faster to fall back to memcpy for C string buffers
> as I did in buffer_or_output() here:
> http://git.sv.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;h=b1428e31
>
> patch looks good.

Pushed.
Thanks for the review.

Reply via email to