This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch master updated. glibc-2.29.9000-94-g457208b


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  457208b1e9498c1238b7af4387529388df0414c1 (commit)
       via  30a7e2081c690dbb22022e1a7d276341b7391434 (commit)
       via  ddf21ec79f25410bed8ab25de5a7d3003a8d03b8 (commit)
       via  4d8015639a750aacd899e293bceeabb15bde9803 (commit)
       via  81a14439417552324ec6ca71f65ddf8e7cdd51c7 (commit)
       via  39ef07441910c2d2f8c02579e808862194b9a23b (commit)
       via  7b3fb620519f6887b2650cc8e0e3267e44914c7b (commit)
      from  aa0e46636a5b71b609a41e9ab97134cd76ac1522 (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=457208b1e9498c1238b7af4387529388df0414c1

commit 457208b1e9498c1238b7af4387529388df0414c1
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Tue Feb 5 18:55:59 2019 -0200

    wcsmbs: optimize wcsnlen
    
    This patch rewrites wcsnlen using wmemchr.  The generic wmemchr
    already uses the strategy (loop unrolling and tail handling) and
    by using it it allows architectures that have optimized wmemchr
    (s390 and x86_64) to optimize wcsnlen as well.
    
    Checked on x86_64-linux-gnu.
    
    	* wcsmbs/wcsnlen.c (__wcsnlen): Rewrite using wmemchr.

diff --git a/ChangeLog b/ChangeLog
index 97e70aa..9ab66cf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2019-02-27  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
 
+	* wcsmbs/wcsnlen.c (__wcsnlen): Rewrite using wmemchr.
+
 	* wcsmbs/wcsncpy.c (__wcsncpy): Rewrite using wcsnlen, wmemset, and
 	wmemcpy.
 
diff --git a/wcsmbs/wcsnlen.c b/wcsmbs/wcsnlen.c
index f3d5fc1..d38c7e4 100644
--- a/wcsmbs/wcsnlen.c
+++ b/wcsmbs/wcsnlen.c
@@ -26,24 +26,10 @@
 size_t
 __wcsnlen (const wchar_t *s, size_t maxlen)
 {
-  size_t len = 0;
-
-  while (maxlen > 0 && s[len] != L'\0')
-    {
-      ++len;
-      if (--maxlen == 0 || s[len] == L'\0')
-	return len;
-      ++len;
-      if (--maxlen == 0 || s[len] == L'\0')
-	return len;
-      ++len;
-      if (--maxlen == 0 || s[len] == L'\0')
-	return len;
-      ++len;
-      --maxlen;
-    }
-
-  return len;
+  const wchar_t *ret = __wmemchr (s, L'\0', maxlen);
+  if (ret)
+    maxlen = ret - s;
+  return maxlen;
 }
 #ifndef WCSNLEN
 weak_alias (__wcsnlen, wcsnlen)

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=30a7e2081c690dbb22022e1a7d276341b7391434

commit 30a7e2081c690dbb22022e1a7d276341b7391434
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Tue Feb 5 18:48:31 2019 -0200

    wcsmbs: optimize wcsncpy
    
    This patch rewrites wcsncpy using wcsnlen, wmemset, and wmemcpy.  This is
    similar to the optimization done on strncpy by f6482cf29d and 6423d4754c.
    
    Checked on x86_64-linux-gnu.
    
    	* wcsmbs/wcsncpy.c (__wcsncpy): Rewrite using wcsnlen, wmemset, and
    	wmemcpy.

diff --git a/ChangeLog b/ChangeLog
index d51188c..97e70aa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2019-02-27  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
 
+	* wcsmbs/wcsncpy.c (__wcsncpy): Rewrite using wcsnlen, wmemset, and
+	wmemcpy.
+
 	* wcsmbs/wcsncat.c (wcsncat): Rewrite using wcslen, wcsnlen, and
 	wmemcpy.
 
diff --git a/wcsmbs/wcsncpy.c b/wcsmbs/wcsncpy.c
index 2fd523c..d5d7f4a 100644
--- a/wcsmbs/wcsncpy.c
+++ b/wcsmbs/wcsncpy.c
@@ -26,62 +26,10 @@
 wchar_t *
 __wcsncpy (wchar_t *dest, const wchar_t *src, size_t n)
 {
-  wint_t c;
-  wchar_t *const s = dest;
-
-  --dest;
-
-  if (n >= 4)
-    {
-      size_t n4 = n >> 2;
-
-      for (;;)
-	{
-	  c = *src++;
-	  *++dest = c;
-	  if (c == L'\0')
-	    break;
-	  c = *src++;
-	  *++dest = c;
-	  if (c == L'\0')
-	    break;
-	  c = *src++;
-	  *++dest = c;
-	  if (c == L'\0')
-	    break;
-	  c = *src++;
-	  *++dest = c;
-	  if (c == L'\0')
-	    break;
-	  if (--n4 == 0)
-	    goto last_chars;
-	}
-      n = n - (dest - s) - 1;
-      if (n == 0)
-	return s;
-      goto zero_fill;
-    }
-
- last_chars:
-  n &= 3;
-  if (n == 0)
-    return s;
-
-  do
-    {
-      c = *src++;
-      *++dest = c;
-      if (--n == 0)
-	return s;
-    }
-  while (c != L'\0');
-
- zero_fill:
-  do
-    *++dest = L'\0';
-  while (--n > 0);
-
-  return s;
+  size_t size = __wcsnlen (src, n);
+  if (size != n)
+    __wmemset (dest + size, L'\0', n - size);
+  return __wmemcpy (dest, src, size);
 }
 #ifndef WCSNCPY
 weak_alias (__wcsncpy, wcsncpy)

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=ddf21ec79f25410bed8ab25de5a7d3003a8d03b8

commit ddf21ec79f25410bed8ab25de5a7d3003a8d03b8
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Tue Feb 5 18:43:18 2019 -0200

    wcsmbs: optimize wcsncat
    
    This patch rewrites wcsncat using wcslen, wcsnlen, and wmemcpy.  This is
    similar to the optimization done on strncat by 3eb38795db and e80514b5a8.
    
    Checked on x86_64-linux-gnu.
    
    	* wcsmbs/wcsncat.c (wcsncat): Rewrite using wcslen, wcsnlen, and
    	wmemcpy.

diff --git a/ChangeLog b/ChangeLog
index 2406275..d51188c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2019-02-27  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
 
+	* wcsmbs/wcsncat.c (wcsncat): Rewrite using wcslen, wcsnlen, and
+	wmemcpy.
+
 	* wcsmbs/wcscpy.c (__wcpcpy): Rewrite using wcslen and wmemcpy.
 
 	* include/wchar.h (__wcscpy): New prototype.
diff --git a/wcsmbs/wcsncat.c b/wcsmbs/wcsncat.c
index 65e9b22..cb6fe71 100644
--- a/wcsmbs/wcsncat.c
+++ b/wcsmbs/wcsncat.c
@@ -26,54 +26,15 @@
 wchar_t *
 WCSNCAT (wchar_t *dest, const wchar_t *src, size_t n)
 {
-  wchar_t c;
-  wchar_t * const s = dest;
+  wchar_t *ret = dest;
 
-  /* Find the end of DEST.  */
-  do
-    c = *dest++;
-  while (c != L'\0');
+  /* Find the end of dest.  */
+  dest += __wcslen (dest);
 
-  /* Make DEST point before next character, so we can increment
-     it while memory is read (wins on pipelined cpus).	*/
-  dest -= 2;
+  size_t ds = __wcsnlen (src, n);
 
-  if (n >= 4)
-    {
-      size_t n4 = n >> 2;
-      do
-	{
-	  c = *src++;
-	  *++dest = c;
-	  if (c == L'\0')
-	    return s;
-	  c = *src++;
-	  *++dest = c;
-	  if (c == L'\0')
-	    return s;
-	  c = *src++;
-	  *++dest = c;
-	  if (c == L'\0')
-	    return s;
-	  c = *src++;
-	  *++dest = c;
-	  if (c == L'\0')
-	    return s;
-	} while (--n4 > 0);
-      n &= 3;
-    }
+  dest[ds] = L'\0';
+  __wmemcpy (dest, src, ds);
 
-  while (n > 0)
-    {
-      c = *src++;
-      *++dest = c;
-      if (c == L'\0')
-	return s;
-      n--;
-    }
-
-  if (c != L'\0')
-    *++dest = L'\0';
-
-  return s;
+  return ret;
 }

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=4d8015639a750aacd899e293bceeabb15bde9803

commit 4d8015639a750aacd899e293bceeabb15bde9803
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Tue Feb 5 18:32:03 2019 -0200

    wcsmbs: optimize wcscpy
    
    This patch rewrites wcscpy using wcslen and wmemcpy.  This is similar
    to the optimization done on strcpy by b863d2bc4d.
    
    Checked on x86_64-linux-gnu.
    
    	* wcsmbs/wcscpy.c (__wcpcpy): Rewrite using wcslen and wmemcpy.

diff --git a/ChangeLog b/ChangeLog
index b963736..2406275 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2019-02-27  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
 
+	* wcsmbs/wcscpy.c (__wcpcpy): Rewrite using wcslen and wmemcpy.
+
 	* include/wchar.h (__wcscpy): New prototype.
 	* sysdeps/powerpc/powerpc32/power4/multiarch/wcscpy-ppc32.c
 	(__wcscpy): Route internal symbol to generic implementation.
diff --git a/wcsmbs/wcscpy.c b/wcsmbs/wcscpy.c
index 636bf6b..6fb2969 100644
--- a/wcsmbs/wcscpy.c
+++ b/wcsmbs/wcscpy.c
@@ -16,7 +16,6 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#include <stddef.h>
 #include <wchar.h>
 
 
@@ -28,35 +27,7 @@
 wchar_t *
 __wcscpy (wchar_t *dest, const wchar_t *src)
 {
-  wint_t c;
-  wchar_t *wcp;
-
-  if (__alignof__ (wchar_t) >= sizeof (wchar_t))
-    {
-      const ptrdiff_t off = dest - src - 1;
-
-      wcp = (wchar_t *) src;
-
-      do
-	{
-	  c = *wcp++;
-	  wcp[off] = c;
-	}
-      while (c != L'\0');
-    }
-  else
-    {
-      wcp = dest;
-
-      do
-	{
-	  c = *src++;
-	  *wcp++ = c;
-	}
-      while (c != L'\0');
-    }
-
-  return dest;
+  return __wmemcpy (dest, src, __wcslen (src) + 1);
 }
 #ifndef WCSCPY
 weak_alias (__wcscpy, wcscpy)

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=81a14439417552324ec6ca71f65ddf8e7cdd51c7

commit 81a14439417552324ec6ca71f65ddf8e7cdd51c7
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Tue Feb 5 17:35:12 2019 -0200

    wcsmbs: optimize wcscat
    
    This patch rewrites wcscat using wcslen and wcscpy.  This is similar to
    the optimization done on strcat by 6e46de42fe.
    
    The strcpy changes are mainly to add the internal alias to avoid PLT
    calls.
    
    Checked on x86_64-linux-gnu and a build against the affected
    architectures.
    
    	* include/wchar.h (__wcscpy): New prototype.
    	* sysdeps/powerpc/powerpc32/power4/multiarch/wcscpy-ppc32.c
    	(__wcscpy): Route internal symbol to generic implementation.
    	* sysdeps/powerpc/powerpc32/power4/multiarch/wcscpy.c (wcscpy):
    	Add internal __wcscpy alias.
    	* sysdeps/powerpc/powerpc64/multiarch/wcscpy.c (wcscpy): Likewise.
    	* sysdeps/s390/wcscpy.c (wcscpy): Likewise.
    	* sysdeps/x86_64/multiarch/wcscpy.c (wcscpy): Likewise.
    	* wcsmbs/wcscpy.c (wcscpy): Add
    	* sysdeps/x86_64/multiarch/wcscpy-c.c (WCSCPY): Adjust macro to
    	use generic implementation.
    	* wcsmbs/wcscat.c (wcscat): Rewrite using wcslen and wcscpy.

diff --git a/ChangeLog b/ChangeLog
index 5ff8f8a..b963736 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,18 @@
 2019-02-27  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
 
+	* include/wchar.h (__wcscpy): New prototype.
+	* sysdeps/powerpc/powerpc32/power4/multiarch/wcscpy-ppc32.c
+	(__wcscpy): Route internal symbol to generic implementation.
+	* sysdeps/powerpc/powerpc32/power4/multiarch/wcscpy.c (wcscpy):
+	Add internal __wcscpy alias.
+	* sysdeps/powerpc/powerpc64/multiarch/wcscpy.c (wcscpy): Likewise.
+	* sysdeps/s390/wcscpy.c (wcscpy): Likewise.
+	* sysdeps/x86_64/multiarch/wcscpy.c (wcscpy): Likewise.
+	* wcsmbs/wcscpy.c (wcscpy): Add
+	* sysdeps/x86_64/multiarch/wcscpy-c.c (WCSCPY): Adjust macro to
+	use generic implementation.
+	* wcsmbs/wcscat.c (wcscat): Rewrite using wcslen and wcscpy.
+
 	* wcsmbs/wcpncpy.c (__wcpcpy): Rewrite using wcslen, wmemcpy, and
 	wmemset.
 
diff --git a/include/wchar.h b/include/wchar.h
index 614073b..2cb4495 100644
--- a/include/wchar.h
+++ b/include/wchar.h
@@ -182,6 +182,10 @@ extern size_t __wcsnrtombs (char *__restrict __dst,
 			    size_t __nwc, size_t __len,
 			    __mbstate_t *__restrict __ps)
      attribute_hidden;
+extern wchar_t *__wcscpy (wchar_t *__restrict __dest,
+			  const wchar_t *__restrict __src)
+			  attribute_hidden __nonnull ((1, 2));
+libc_hidden_proto (__wcscpy)
 extern wchar_t *__wcsncpy (wchar_t *__restrict __dest,
 			   const wchar_t *__restrict __src, size_t __n);
 extern wchar_t *__wcpcpy (wchar_t *__dest, const wchar_t *__src);
diff --git a/sysdeps/powerpc/powerpc32/power4/multiarch/wcscpy-ppc32.c b/sysdeps/powerpc/powerpc32/power4/multiarch/wcscpy-ppc32.c
index 52b692b..31e0d81 100644
--- a/sysdeps/powerpc/powerpc32/power4/multiarch/wcscpy-ppc32.c
+++ b/sysdeps/powerpc/powerpc32/power4/multiarch/wcscpy-ppc32.c
@@ -17,10 +17,11 @@
 
 #include <wchar.h>
 
-#if IS_IN (libc)
-# define WCSCPY  __wcscpy_ppc
-#endif
-
 extern __typeof (wcscpy) __wcscpy_ppc;
 
+#define WCSCPY  __wcscpy_ppc
 #include <wcsmbs/wcscpy.c>
+
+#ifdef SHARED
+__hidden_ver1 (__wcscpy_ppc, __GI___wcscpy, __wcscpy_ppc);
+#endif
diff --git a/sysdeps/powerpc/powerpc32/power4/multiarch/wcscpy.c b/sysdeps/powerpc/powerpc32/power4/multiarch/wcscpy.c
index ecca37d..e879846 100644
--- a/sysdeps/powerpc/powerpc32/power4/multiarch/wcscpy.c
+++ b/sysdeps/powerpc/powerpc32/power4/multiarch/wcscpy.c
@@ -17,20 +17,20 @@
    <http://www.gnu.org/licenses/>.  */
 
 #if IS_IN (libc)
+# define wcscpy __redirect_wcscpy
 # include <wchar.h>
-# include <shlib-compat.h>
+# undef wcscpy
 # include "init-arch.h"
 
-extern __typeof (wcscpy) __wcscpy_ppc attribute_hidden;
-extern __typeof (wcscpy) __wcscpy_power6 attribute_hidden;
-extern __typeof (wcscpy) __wcscpy_power7 attribute_hidden;
+extern __typeof (__redirect_wcscpy) __wcscpy_ppc attribute_hidden;
+extern __typeof (__redirect_wcscpy) __wcscpy_power6 attribute_hidden;
+extern __typeof (__redirect_wcscpy) __wcscpy_power7 attribute_hidden;
 
-libc_ifunc (wcscpy,
-	     (hwcap & PPC_FEATURE_HAS_VSX)
-             ? __wcscpy_power7 :
-	       (hwcap & PPC_FEATURE_ARCH_2_05)
-	       ? __wcscpy_power6
-             : __wcscpy_ppc);
-#else
-#include <wcsmbs/wcscpy.c>
+libc_ifunc_redirected (__redirect_wcscpy, wcscpy,
+		       (hwcap & PPC_FEATURE_HAS_VSX)
+		       ? __wcscpy_power7 :
+			 (hwcap & PPC_FEATURE_ARCH_2_05)
+			 ? __wcscpy_power6
+		       : __wcscpy_ppc);
+weak_alias (wcscpy, __wcscpy)
 #endif
diff --git a/sysdeps/powerpc/powerpc64/multiarch/wcscpy.c b/sysdeps/powerpc/powerpc64/multiarch/wcscpy.c
index 3cea9a4..3f918b2 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/wcscpy.c
+++ b/sysdeps/powerpc/powerpc64/multiarch/wcscpy.c
@@ -16,21 +16,20 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#if IS_IN (libc)
-# include <wchar.h>
-# include <shlib-compat.h>
-# include "init-arch.h"
+#define __wcscpy __redirect___wcscpy
+#include <wchar.h>
+#undef __wcscpy
+#include <shlib-compat.h>
+#include "init-arch.h"
 
 extern __typeof (wcscpy) __wcscpy_ppc attribute_hidden;
 extern __typeof (wcscpy) __wcscpy_power6 attribute_hidden;
 extern __typeof (wcscpy) __wcscpy_power7 attribute_hidden;
 
-libc_ifunc (wcscpy,
-	     (hwcap & PPC_FEATURE_HAS_VSX)
-             ? __wcscpy_power7 :
-	       (hwcap & PPC_FEATURE_ARCH_2_05)
-	       ? __wcscpy_power6
-             : __wcscpy_ppc);
-#else
-#include <wcsmbs/wcscpy.c>
-#endif
+libc_ifunc_redirected (__redirect___wcscpy, __wcscpy,
+		       (hwcap & PPC_FEATURE_HAS_VSX)
+		       ? __wcscpy_power7 :
+		         (hwcap & PPC_FEATURE_ARCH_2_05)
+		         ? __wcscpy_power6
+	               : __wcscpy_ppc);
+weak_alias (__wcscpy, wcscpy)
diff --git a/sysdeps/s390/wcscpy.c b/sysdeps/s390/wcscpy.c
index 2e8ef50..a569f91 100644
--- a/sysdeps/s390/wcscpy.c
+++ b/sysdeps/s390/wcscpy.c
@@ -30,9 +30,11 @@ extern __typeof (wcscpy) WCSCPY_C attribute_hidden;
 extern __typeof (wcscpy) WCSCPY_Z13 attribute_hidden;
 # endif
 
-s390_libc_ifunc_expr (wcscpy, wcscpy,
+s390_libc_ifunc_expr (wcscpy, __wcscpy,
 		      (HAVE_WCSCPY_Z13 && (hwcap & HWCAP_S390_VX))
 		      ? WCSCPY_Z13
 		      : WCSCPY_DEFAULT
 		      )
+weak_alias (__wcscpy, wcscpy)
+libc_hidden_def (__wcscpy)
 #endif
diff --git a/sysdeps/x86_64/multiarch/wcscpy-c.c b/sysdeps/x86_64/multiarch/wcscpy-c.c
index a51a83a..26d6984 100644
--- a/sysdeps/x86_64/multiarch/wcscpy-c.c
+++ b/sysdeps/x86_64/multiarch/wcscpy-c.c
@@ -1,5 +1,5 @@
 #if IS_IN (libc)
-# define wcscpy  __wcscpy_sse2
+# define WCSCPY  __wcscpy_sse2
 #endif
 
-#include "wcsmbs/wcscpy.c"
+#include <wcsmbs/wcscpy.c>
diff --git a/sysdeps/x86_64/multiarch/wcscpy.c b/sysdeps/x86_64/multiarch/wcscpy.c
index 101a585..96151b4 100644
--- a/sysdeps/x86_64/multiarch/wcscpy.c
+++ b/sysdeps/x86_64/multiarch/wcscpy.c
@@ -19,9 +19,9 @@
 
 /* Define multiple versions only for the definition in libc.  */
 #if IS_IN (libc)
-# define wcscpy __redirect_wcscpy
+# define __wcscpy __redirect_wcscpy
 # include <wchar.h>
-# undef wcscpy
+# undef __wcscpy
 
 # define SYMBOL_NAME wcscpy
 # include <init-arch.h>
@@ -40,5 +40,10 @@ IFUNC_SELECTOR (void)
   return OPTIMIZE (sse2);
 }
 
-libc_ifunc_redirected (__redirect_wcscpy, wcscpy, IFUNC_SELECTOR ());
+libc_ifunc_redirected (__redirect_wcscpy, __wcscpy, IFUNC_SELECTOR ());
+weak_alias (__wcscpy, wcscpy)
+# ifdef SHARED
+__hidden_ver1 (__wcscpy, __GI___wcscpy, __redirect_wcscpy)
+  __attribute__((visibility ("hidden"))) __attribute_copy__ (wcscpy);
+# endif
 #endif
diff --git a/wcsmbs/wcscat.c b/wcsmbs/wcscat.c
index 6a25b20..1a9d667 100644
--- a/wcsmbs/wcscat.c
+++ b/wcsmbs/wcscat.c
@@ -26,26 +26,7 @@
 wchar_t *
 __wcscat (wchar_t *dest, const wchar_t *src)
 {
-  wchar_t *s1 = dest;
-  const wchar_t *s2 = src;
-  wchar_t c;
-
-  /* Find the end of the string.  */
-  do
-    c = *s1++;
-  while (c != L'\0');
-
-  /* Make S1 point before the next character, so we can increment
-     it while memory is read (wins on pipelined cpus).	*/
-  s1 -= 2;
-
-  do
-    {
-      c = *s2++;
-      *++s1 = c;
-    }
-  while (c != L'\0');
-
+  __wcscpy (dest + __wcslen (dest), src);
   return dest;
 }
 #ifndef WCSCAT
diff --git a/wcsmbs/wcscpy.c b/wcsmbs/wcscpy.c
index 7a34c77..636bf6b 100644
--- a/wcsmbs/wcscpy.c
+++ b/wcsmbs/wcscpy.c
@@ -20,13 +20,13 @@
 #include <wchar.h>
 
 
-#ifndef WCSCPY
-# define WCSCPY wcscpy
+#ifdef WCSCPY
+# define __wcscpy WCSCPY
 #endif
 
 /* Copy SRC to DEST.  */
 wchar_t *
-WCSCPY (wchar_t *dest, const wchar_t *src)
+__wcscpy (wchar_t *dest, const wchar_t *src)
 {
   wint_t c;
   wchar_t *wcp;
@@ -58,3 +58,7 @@ WCSCPY (wchar_t *dest, const wchar_t *src)
 
   return dest;
 }
+#ifndef WCSCPY
+weak_alias (__wcscpy, wcscpy)
+libc_hidden_def (__wcscpy)
+#endif

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=39ef07441910c2d2f8c02579e808862194b9a23b

commit 39ef07441910c2d2f8c02579e808862194b9a23b
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Tue Feb 5 17:34:21 2019 -0200

    wcsmbs: optimize wcpncpy
    
    This patch rewrites wcpncpy using wcslen, wmemcpy, and wmemset.  This is
    similar to the optimization done on stpncpy by 48497aba8e.
    
    Checked on x86_64-linux-gnu.
    
            * wcsmbs/wcpncpy.c (__wcpcpy): Rewrite using wcslen, wmemcpy, and
    	wmemset.

diff --git a/ChangeLog b/ChangeLog
index 2e0b69d..5ff8f8a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2019-02-27  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
 
+	* wcsmbs/wcpncpy.c (__wcpcpy): Rewrite using wcslen, wmemcpy, and
+	wmemset.
+
 	* sysdeps/m68k/wcpcpy.c: Remove file.
 	* wcsmbs/wcpcpy.c (__wcpcpy): Rewrite using wcslen and wmemcpy.
 
diff --git a/wcsmbs/wcpncpy.c b/wcsmbs/wcpncpy.c
index 7568f3b..74f22c2 100644
--- a/wcsmbs/wcpncpy.c
+++ b/wcsmbs/wcpncpy.c
@@ -27,59 +27,12 @@
 wchar_t *
 __wcpncpy (wchar_t *dest, const wchar_t *src, size_t n)
 {
-  wint_t c;
-  wchar_t *const s = dest;
-
-  if (n >= 4)
-    {
-      size_t n4 = n >> 2;
-
-      for (;;)
-	{
-	  c = *src++;
-	  *dest++ = c;
-	  if (c == L'\0')
-	    break;
-	  c = *src++;
-	  *dest++ = c;
-	  if (c == L'\0')
-	    break;
-	  c = *src++;
-	  *dest++ = c;
-	  if (c == L'\0')
-	    break;
-	  c = *src++;
-	  *dest++ = c;
-	  if (c == L'\0')
-	    break;
-	  if (--n4 == 0)
-	    goto last_chars;
-	}
-      n -= dest - s;
-      goto zero_fill;
-    }
-
- last_chars:
-  n &= 3;
-  if (n == 0)
+  size_t size = __wcsnlen (src, n);
+  __wmemcpy (dest, src, size);
+  dest += size;
+  if (size == n)
     return dest;
-
-  for (;;)
-    {
-      c = *src++;
-      --n;
-      *dest++ = c;
-      if (c == L'\0')
-	break;
-      if (n == 0)
-	return dest;
-    }
-
- zero_fill:
-  while (n-- > 0)
-    dest[n] = L'\0';
-
-  return dest - 1;
+  return wmemset (dest, L'\0', (n - size));
 }
 
 #ifndef WCPNCPY

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=7b3fb620519f6887b2650cc8e0e3267e44914c7b

commit 7b3fb620519f6887b2650cc8e0e3267e44914c7b
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Tue Feb 5 17:34:05 2019 -0200

    wcsmbs: optimize wcpcpy
    
    This patch rewrites wcpcpy using wcslen and wmemcpy.  This is
    similar to the optimizatio done on stpcpy by f559d8cf29.
    
    Checked on x86_64-linux-gnu and string tests on a simulated
    m68k-linux-gnu.
    
    	* sysdeps/m68k/wcpcpy.c: Remove file.
    	* wcsmbs/wcpcpy.c (__wcpcpy): Rewrite using wcslen and wmemcpy.

diff --git a/ChangeLog b/ChangeLog
index 8096175..2e0b69d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2019-02-27  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
+
+	* sysdeps/m68k/wcpcpy.c: Remove file.
+	* wcsmbs/wcpcpy.c (__wcpcpy): Rewrite using wcslen and wmemcpy.
+
 2019-02-26  Joseph Myers  <joseph@codesourcery.com>
 
 	* sysdeps/arm/sysdep.h (#if condition): Break lines before rather
diff --git a/sysdeps/m68k/wcpcpy.c b/sysdeps/m68k/wcpcpy.c
deleted file mode 100644
index a4bac08..0000000
--- a/sysdeps/m68k/wcpcpy.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Copyright (C) 1996-2019 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1996.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library.  If not, see
-   <http://www.gnu.org/licenses/>.  */
-
-/* The generic version of this file assumes that __alignof__(wchar_t) ==
-   sizeof (wchar_t).  We therefore use this port-specific implementation
-   instead.  */
-#include <wchar.h>
-
-/* Copy SRC to DEST, returning the address of the terminating L'\0' in
-   DEST.  */
-wchar_t *
-__wcpcpy (wchar_t *dest, const wchar_t *src)
-{
-  do
-    ;
-  while ((*dest++ = *src++));
-
-  return dest - 1;
-}
-
-weak_alias (__wcpcpy, wcpcpy)
diff --git a/wcsmbs/wcpcpy.c b/wcsmbs/wcpcpy.c
index 01978e9..666fe15 100644
--- a/wcsmbs/wcpcpy.c
+++ b/wcsmbs/wcpcpy.c
@@ -18,31 +18,18 @@
 
 #include <wchar.h>
 
-#define __need_ptrdiff_t
-#include <stddef.h>
-
 #ifdef WCPCPY
 # define __wcpcpy WCPCPY
 #endif
+
 /* Copy SRC to DEST, returning the address of the terminating L'\0' in
    DEST.  */
 wchar_t *
 __wcpcpy (wchar_t *dest, const wchar_t *src)
 {
-  wchar_t *wcp = (wchar_t *) dest - 1;
-  wint_t c;
-  const ptrdiff_t off = src - dest + 1;
-
-  do
-    {
-      c = wcp[off];
-      *++wcp = c;
-    }
-  while (c != L'\0');
-
-  return wcp;
+  size_t len = __wcslen (src);
+  return __wmemcpy (dest, src, len + 1) + len;
 }
-
 #ifndef WCPCPY
 weak_alias (__wcpcpy, wcpcpy)
 #endif

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

Summary of changes:
 ChangeLog                                          |   31 ++++++++++
 include/wchar.h                                    |    4 +
 sysdeps/m68k/wcpcpy.c                              |   36 ------------
 .../powerpc32/power4/multiarch/wcscpy-ppc32.c      |    9 ++-
 .../powerpc/powerpc32/power4/multiarch/wcscpy.c    |   24 ++++----
 sysdeps/powerpc/powerpc64/multiarch/wcscpy.c       |   25 ++++----
 sysdeps/s390/wcscpy.c                              |    4 +-
 sysdeps/x86_64/multiarch/wcscpy-c.c                |    4 +-
 sysdeps/x86_64/multiarch/wcscpy.c                  |   11 +++-
 wcsmbs/wcpcpy.c                                    |   19 +-----
 wcsmbs/wcpncpy.c                                   |   57 ++-----------------
 wcsmbs/wcscat.c                                    |   21 +-------
 wcsmbs/wcscpy.c                                    |   41 +++-----------
 wcsmbs/wcsncat.c                                   |   53 ++---------------
 wcsmbs/wcsncpy.c                                   |   60 +------------------
 wcsmbs/wcsnlen.c                                   |   22 +------
 16 files changed, 109 insertions(+), 312 deletions(-)
 delete mode 100644 sysdeps/m68k/wcpcpy.c


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]