This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH v6] Implement strlcpy [BZ #178]
- From: Florian Weimer <fweimer at redhat dot com>
- To: ricaljasan <ricaljasan at pacific dot net>
- Cc: libc-alpha at sourceware dot org
- Date: Wed, 18 Nov 2015 11:28:51 +0100
- Subject: Re: [PATCH v6] Implement strlcpy [BZ #178]
- Authentication-results: sourceware.org; auth=none
- References: <564B3494 dot 4040209 at redhat dot com> <564C47D0 dot 6040008 at pacific dot net>
On 11/18/2015 10:41 AM, ricaljasan wrote:
>> +@comment string.h
>> +@comment BSD
>> +@deftypefun size_t strlcpy (char *restrict @var{to}, const char *restrict @var{from}, size_t @var{size})
>> +@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}} This function is similar
>
> The beginning of this line should be moved below the @safety macro.
Thanks, fixed.
>> +@strong{Note:} GNU programs should not use statically sized buffers for
>> +storing strings. @xref{Semantics, , Writing Robust Programs, standards,
>> +The GNU Coding Standards}. Instead of using @code{strlcpy}, it is
>> +usually better to use dynamic memory allocation and functions such as
>> +@code{strdup} or @code{asprintf} to construct strings.
>
> A reference to dynamic memory allocation would be suitable here.
I added:
better to use dynamic memory allocation {+(@pxref{Unconstrained+}
{+Allocation})+} and functions such as @code{strdup} or @code{asprintf}
Florian