mirror of
https://sourceware.org/git/glibc.git
synced 2025-01-03 08:11:08 +00:00
Fix typo in strncat, wcsncat manual entries
* manual/string.texi (Copying and Concatenation): Fix typos in sample implementations of strncat and wcsncat, by having them use the old value of the destination length, not the new one.
This commit is contained in:
parent
8f5e8b01a1
commit
5d1d4918ee
@ -1,3 +1,10 @@
|
|||||||
|
2015-12-04 Paul Eggert <eggert@cs.ucla.edu>
|
||||||
|
|
||||||
|
Fix typo in strncat, wcsncat manual entries
|
||||||
|
* manual/string.texi (Copying and Concatenation): Fix typos in
|
||||||
|
sample implementations of strncat and wcsncat, by having them use
|
||||||
|
the old value of the destination length, not the new one.
|
||||||
|
|
||||||
2015-12-04 Joseph Myers <joseph@codesourcery.com>
|
2015-12-04 Joseph Myers <joseph@codesourcery.com>
|
||||||
|
|
||||||
[BZ #16961]
|
[BZ #16961]
|
||||||
|
@ -996,8 +996,9 @@ The @code{strncat} function could be implemented like this:
|
|||||||
char *
|
char *
|
||||||
strncat (char *to, const char *from, size_t size)
|
strncat (char *to, const char *from, size_t size)
|
||||||
@{
|
@{
|
||||||
memcpy (to + strlen (to), from, strnlen (from, size));
|
size_t len = strlen (to);
|
||||||
to[strlen (to) + strnlen (from, size)] = '\0';
|
memcpy (to + len, from, strnlen (from, size));
|
||||||
|
to[len + strnlen (from, size)] = '\0';
|
||||||
return to;
|
return to;
|
||||||
@}
|
@}
|
||||||
@end group
|
@end group
|
||||||
@ -1025,8 +1026,9 @@ wchar_t *
|
|||||||
wcsncat (wchar_t *restrict wto, const wchar_t *restrict wfrom,
|
wcsncat (wchar_t *restrict wto, const wchar_t *restrict wfrom,
|
||||||
size_t size)
|
size_t size)
|
||||||
@{
|
@{
|
||||||
memcpy (wto + wcslen (wto), wfrom, wcsnlen (wfrom, size) * sizeof (wchar_t));
|
size_t len = wcslen (wto);
|
||||||
wto[wcslen (to) + wcsnlen (wfrom, size)] = '\0';
|
memcpy (wto + len, wfrom, wcsnlen (wfrom, size) * sizeof (wchar_t));
|
||||||
|
wto[len + wcsnlen (wfrom, size)] = L'\0';
|
||||||
return wto;
|
return wto;
|
||||||
@}
|
@}
|
||||||
@end group
|
@end group
|
||||||
|
Loading…
Reference in New Issue
Block a user