GNU C Library master sources branch master updated. glibc-2.22-580-g5d1d491

eggert@sourceware.org eggert@sourceware.org
Fri Dec 4 23:24:00 GMT 2015


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  5d1d4918eebdaaf0ab0a5baf28c502c32c21f12e (commit)
      from  8f5e8b01a1da2a207228f2072c934fa5918554b8 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=5d1d4918eebdaaf0ab0a5baf28c502c32c21f12e

commit 5d1d4918eebdaaf0ab0a5baf28c502c32c21f12e
Author: Paul Eggert <eggert@cs.ucla.edu>
Date:   Fri Dec 4 15:23:18 2015 -0800

    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.

diff --git a/ChangeLog b/ChangeLog
index edd7ccf..379ba75 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
 
 	[BZ #16961]
diff --git a/manual/string.texi b/manual/string.texi
index 4f276a9..8f0f5fa 100644
--- a/manual/string.texi
+++ b/manual/string.texi
@@ -996,8 +996,9 @@ The @code{strncat} function could be implemented like this:
 char *
 strncat (char *to, const char *from, size_t size)
 @{
-  memcpy (to + strlen (to), from, strnlen (from, size));
-  to[strlen (to) + strnlen (from, size)] = '\0';
+  size_t len = strlen (to);
+  memcpy (to + len, from, strnlen (from, size));
+  to[len + strnlen (from, size)] = '\0';
   return to;
 @}
 @end group
@@ -1025,8 +1026,9 @@ wchar_t *
 wcsncat (wchar_t *restrict wto, const wchar_t *restrict wfrom,
          size_t size)
 @{
-  memcpy (wto + wcslen (wto), wfrom, wcsnlen (wfrom, size) * sizeof (wchar_t));
-  wto[wcslen (to) + wcsnlen (wfrom, size)] = '\0';
+  size_t len = wcslen (wto);
+  memcpy (wto + len, wfrom, wcsnlen (wfrom, size) * sizeof (wchar_t));
+  wto[len + wcsnlen (wfrom, size)] = L'\0';
   return wto;
 @}
 @end group

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog          |    7 +++++++
 manual/string.texi |   10 ++++++----
 2 files changed, 13 insertions(+), 4 deletions(-)


hooks/post-receive
-- 
GNU C Library master sources



More information about the Glibc-cvs mailing list