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.14-444-g1f1e194


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  1f1e194720177de3cbc2a84bc62d22e63cb23d4a (commit)
       via  37822576b8cf2a04fb34212fb0ae82d3b607bed2 (commit)
      from  31ea014d8b09e6aa4f07cdb86c94ce50f1b92c2a (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://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=1f1e194720177de3cbc2a84bc62d22e63cb23d4a

commit 1f1e194720177de3cbc2a84bc62d22e63cb23d4a
Author: Andreas Schwab <schwab@redhat.com>
Date:   Tue Oct 25 15:06:34 2011 +0200

    Use correct signedness in default implementations of wcscmp and wmemcmp

diff --git a/ChangeLog b/ChangeLog
index 1d0e0fc..fbd5a49 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2011-10-25  Andreas Schwab  <schwab@redhat.com>
 
+	* wcsmbs/wcscmp.c (WCSCMP): Compare as wchar_t, not wint_t.
+	* wcsmbs/wmemcmp.c (WMEMCMP): Likewise.
+
 	* string/test-strchr.c (do_test): Don't generate NUL bytes.
 
 2011-10-25  Ulrich Drepper  <drepper@gmail.com>
diff --git a/wcsmbs/wcscmp.c b/wcsmbs/wcscmp.c
index ddbd4aa..9872835 100644
--- a/wcsmbs/wcscmp.c
+++ b/wcsmbs/wcscmp.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1996, 1997, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
 
@@ -31,12 +31,12 @@ WCSCMP (s1, s2)
      const wchar_t *s1;
      const wchar_t *s2;
 {
-  wint_t c1, c2;
+  wchar_t c1, c2;
 
   do
     {
-      c1 = (wint_t) *s1++;
-      c2 = (wint_t) *s2++;
+      c1 = *s1++;
+      c2 = *s2++;
       if (c2 == L'\0')
 	return c1 - c2;
     }
diff --git a/wcsmbs/wmemcmp.c b/wcsmbs/wmemcmp.c
index 73c6394..9bd556e 100644
--- a/wcsmbs/wmemcmp.c
+++ b/wcsmbs/wmemcmp.c
@@ -29,25 +29,25 @@ WMEMCMP (s1, s2, n)
      const wchar_t *s2;
      size_t n;
 {
-  register wint_t c1;
-  register wint_t c2;
+  register wchar_t c1;
+  register wchar_t c2;
 
   while (n >= 4)
     {
-      c1 = (wint_t) s1[0];
-      c2 = (wint_t) s2[0];
+      c1 = s1[0];
+      c2 = s2[0];
       if (c1 - c2 != 0)
 	return c1 > c2 ? 1 : -1;
-      c1 = (wint_t) s1[1];
-      c2 = (wint_t) s2[1];
+      c1 = s1[1];
+      c2 = s2[1];
       if (c1 - c2 != 0)
 	return c1 > c2 ? 1 : -1;
-      c1 = (wint_t) s1[2];
-      c2 = (wint_t) s2[2];
+      c1 = s1[2];
+      c2 = s2[2];
       if (c1 - c2 != 0)
 	return c1 > c2 ? 1 : -1;
-      c1 = (wint_t) s1[3];
-      c2 = (wint_t) s2[3];
+      c1 = s1[3];
+      c2 = s2[3];
       if (c1 - c2 != 0)
 	return c1 > c2 ? 1 : -1;
       s1 += 4;
@@ -57,8 +57,8 @@ WMEMCMP (s1, s2, n)
 
   if (n > 0)
     {
-      c1 = (wint_t) s1[0];
-      c2 = (wint_t) s2[0];
+      c1 = s1[0];
+      c2 = s2[0];
       if (c1 - c2 != 0)
 	return c1 > c2 ? 1 : -1;
       ++s1;
@@ -67,8 +67,8 @@ WMEMCMP (s1, s2, n)
     }
   if (n > 0)
     {
-      c1 = (wint_t) s1[0];
-      c2 = (wint_t) s2[0];
+      c1 = s1[0];
+      c2 = s2[0];
       if (c1 - c2 != 0)
 	return c1 > c2 ? 1 : -1;
       ++s1;
@@ -77,8 +77,8 @@ WMEMCMP (s1, s2, n)
     }
   if (n > 0)
     {
-      c1 = (wint_t) s1[0];
-      c2 = (wint_t) s2[0];
+      c1 = s1[0];
+      c2 = s2[0];
       if (c1 - c2 != 0)
 	return c1 > c2 ? 1 : -1;
     }

http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=37822576b8cf2a04fb34212fb0ae82d3b607bed2

commit 37822576b8cf2a04fb34212fb0ae82d3b607bed2
Author: Andreas Schwab <schwab@redhat.com>
Date:   Tue Oct 25 14:55:08 2011 +0200

    Fix strchr test

diff --git a/ChangeLog b/ChangeLog
index 1046fee..1d0e0fc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2011-10-25  Andreas Schwab  <schwab@redhat.com>
+
+	* string/test-strchr.c (do_test): Don't generate NUL bytes.
+
 2011-10-25  Ulrich Drepper  <drepper@gmail.com>
 
 	* sysdeps/x86_64/fpu/math_private.h: Use VEX encoding when possible.
diff --git a/string/test-strchr.c b/string/test-strchr.c
index 518a4dc..3bbc2f5 100644
--- a/string/test-strchr.c
+++ b/string/test-strchr.c
@@ -63,8 +63,8 @@ stupid_STRCHR (const CHAR *s, int c)
   return NULL;
 }
 
-IMPL (stupid_STRCHR, 1)
-IMPL (simple_STRCHR, 1)
+IMPL (stupid_STRCHR, 0)
+IMPL (simple_STRCHR, 0)
 IMPL (STRCHR, 1)
 
 static void
@@ -100,15 +100,15 @@ do_one_test (impl_t *impl, const CHAR *s, int c, const CHAR *exp_res)
 
 static void
 do_test (size_t align, size_t pos, size_t len, int seek_char, int max_char)
-/* for wcschr: align here means align not in bytes,
- * but in wchar_ts, in bytes it will equal to align * (sizeof (wchar_t))
- * len for wcschr here isn't in bytes but it's number of wchar_t symbols */
+/* For wcschr: align here means align not in bytes,
+   but in wchar_ts, in bytes it will equal to align * (sizeof (wchar_t))
+   len for wcschr here isn't in bytes but it's number of wchar_t symbols.  */
 {
   size_t i;
   CHAR *result;
-  CHAR *buf = (CHAR *) (buf1);
+  CHAR *buf = (CHAR *) buf1;
   align &= 15;
-  if ((align + len) * sizeof(CHAR) >= page_size)
+  if ((align + len) * sizeof (CHAR) >= page_size)
     return;
 
   for (i = 0; i < len; ++i)
@@ -116,6 +116,8 @@ do_test (size_t align, size_t pos, size_t len, int seek_char, int max_char)
       buf[align + i] = 32 + 23 * i % max_char;
       if (buf[align + i] == seek_char)
 	buf[align + i] = seek_char + 1;
+      else if (buf[align + i] == 0)
+	buf[align + i] = 1;
     }
   buf[align + len] = 0;
 
@@ -130,7 +132,8 @@ do_test (size_t align, size_t pos, size_t len, int seek_char, int max_char)
     result = NULL;
 
   if (HP_TIMING_AVAIL)
-    printf ("Length %4zd, alignment in bytes %2zd:", pos, align * sizeof (CHAR));
+    printf ("Length %4zd, alignment in bytes %2zd:",
+	    pos, align * sizeof (CHAR));
 
   FOR_EACH_IMPL (impl, 0)
     do_one_test (impl, buf + align, seek_char, result);
@@ -149,14 +152,15 @@ do_random_tests (void)
 
   for (n = 0; n < ITERATIONS; n++)
     {
-/* for wcschr: align here means align not in bytes, but in wchar_ts,
- * in bytes it will equal to align * (sizeof (wchar_t)) */
+      /* For wcschr: align here means align not in bytes, but in wchar_ts,
+	 in bytes it will equal to align * (sizeof (wchar_t)).  */
       align = random () & 15;
       pos = random () & 511;
       seek_char = random () & 255;
       if (pos + align >= 511)
 	pos = 510 - align - (random () & 7);
-/* len for wcschr here isn't in bytes but it's number of wchar_t symbols */
+      /* len for wcschr here isn't in bytes but it's number of wchar_t
+	 symbols.  */
       len = random () & 511;
       if ((pos == len && seek_char)
 	  || (pos > len && (random () & 1)))

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

Summary of changes:
 ChangeLog            |    7 +++++++
 string/test-strchr.c |   26 +++++++++++++++-----------
 wcsmbs/wcscmp.c      |    8 ++++----
 wcsmbs/wmemcmp.c     |   32 ++++++++++++++++----------------
 4 files changed, 42 insertions(+), 31 deletions(-)


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]