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-422-gafb05e8


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  afb05e81571ac38be64bdf61125ae757460ac71c (commit)
       via  2d09f82f8aafa9dde2dcbfcce5f44fa7bda63388 (commit)
      from  619fcccaa3ef079cafcaddd725eba309c89bef8f (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=afb05e81571ac38be64bdf61125ae757460ac71c

commit afb05e81571ac38be64bdf61125ae757460ac71c
Author: Ulrich Drepper <drepper@gmail.com>
Date:   Sun Oct 23 14:15:06 2011 -0400

    Fix WS

diff --git a/string/test-strchr.c b/string/test-strchr.c
index 9f4b8d1..518a4dc 100644
--- a/string/test-strchr.c
+++ b/string/test-strchr.c
@@ -1,5 +1,5 @@
 /* Test and measure STRCHR functions.
-   Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2002, 2003, 2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Written by Jakub Jelinek <jakub@redhat.com>, 1999.
    Added wcschr support by Liubov Dmitrieva <liubov.dmitrieva@gmail.com>, 2011
@@ -100,7 +100,7 @@ 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, 
+/* 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 */
 {
@@ -115,7 +115,7 @@ 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;
+	buf[align + i] = seek_char + 1;
     }
   buf[align + len] = 0;
 
@@ -156,18 +156,18 @@ do_random_tests (void)
       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)))
 	len = pos + 1 + (random () & 7);
       if (len + align >= 512)
-        len = 511 - align - (random () & 7);
+	len = 511 - align - (random () & 7);
       if (pos == len && seek_char)
 	len = pos + 1;
       j = (pos > len ? pos : len) + align + 64;
       if (j > 512)
-        j = 512;
+	j = 512;
 
       for (i = 0; i < j; i++)
 	{
@@ -200,7 +200,7 @@ do_random_tests (void)
 	if (CALL (impl, (CHAR *) (p + align), seek_char) != result)
 	  {
 	    error (0, 0, "Iteration %zd - wrong result in function \
-                   %s (align in bytes: %zd, seek_char: %d, len: %zd, pos: %zd) %p != %p, p %p",
+		   %s (align in bytes: %zd, seek_char: %d, len: %zd, pos: %zd) %p != %p, p %p",
 		   n, impl->name, align * sizeof (CHAR), seek_char, len, pos,
 		   CALL (impl, (CHAR *) (p + align), seek_char), result, p);
 	    ret = 1;

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

commit 2d09f82f8aafa9dde2dcbfcce5f44fa7bda63388
Author: Liubov Dmitrieva <liubov.dmitrieva@gmail.com>
Date:   Sun Oct 23 14:14:26 2011 -0400

    Add wcschr test cases

diff --git a/ChangeLog b/ChangeLog
index cd0393a..2bc00a4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,14 @@
+2011-10-19  Liubov Dmitrieva  <liubov.dmitrieva@gmail.com>
+
+	* wcsmbs/Makefile (strop-tests): Add wcschr.
+	* wcsmbs/test-wcschr.c: New file.
+	* string/test-strchr.c: Update.
+	Add wcschr support.
+	(WIDE): New macro.
+
 2011-10-18  Liubov Dmitrieva  <liubov.dmitrieva@gmail.com>
 
-	* wcsmbs/Makefile
-	(strop-tests): Add wcslen.
+	* wcsmbs/Makefile (strop-tests): Add wcslen.
 	* wcsmbs/test-wcslen.c: New file.
 	* string/test-strlen.c: Update.
 	Add wcslen support.
diff --git a/string/test-strchr.c b/string/test-strchr.c
index cf25b44..9f4b8d1 100644
--- a/string/test-strchr.c
+++ b/string/test-strchr.c
@@ -1,7 +1,8 @@
-/* Test and measure strchr functions.
+/* Test and measure STRCHR functions.
    Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Written by Jakub Jelinek <jakub@redhat.com>, 1999.
+   Added wcschr support by Liubov Dmitrieva <liubov.dmitrieva@gmail.com>, 2011
 
    The GNU C Library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
@@ -21,38 +22,55 @@
 #define TEST_MAIN
 #include "test-string.h"
 
-typedef char *(*proto_t) (const char *, int);
-char *simple_strchr (const char *, int);
-char *stupid_strchr (const char *, int);
-
-IMPL (stupid_strchr, 0)
-IMPL (simple_strchr, 0)
-IMPL (strchr, 1)
-
-char *
-simple_strchr (const char *s, int c)
+#ifndef WIDE
+# define STRCHR strchr
+# define STRLEN strlen
+# define CHAR char
+# define BIG_CHAR CHAR_MAX
+# define MIDDLE_CHAR 127
+# define SMALL_CHAR 23
+# define UCHAR unsigned char
+#else
+# include <wchar.h>
+# define STRCHR wcschr
+# define STRLEN wcslen
+# define CHAR wchar_t
+# define BIG_CHAR WCHAR_MAX
+# define MIDDLE_CHAR 1121
+# define SMALL_CHAR 851
+# define UCHAR wchar_t
+#endif
+
+typedef CHAR *(*proto_t) (const CHAR *, int);
+
+CHAR *
+simple_STRCHR (const CHAR *s, int c)
 {
-  for (; *s != (char) c; ++s)
+  for (; *s != (CHAR) c; ++s)
     if (*s == '\0')
       return NULL;
-  return (char *) s;
+  return (CHAR *) s;
 }
 
-char *
-stupid_strchr (const char *s, int c)
+CHAR *
+stupid_STRCHR (const CHAR *s, int c)
 {
-  size_t n = strlen (s) + 1;
+  size_t n = STRLEN (s) + 1;
 
   while (n--)
-    if (*s++ == (char) c)
-      return (char *) s - 1;
+    if (*s++ == (CHAR) c)
+      return (CHAR *) s - 1;
   return NULL;
 }
 
+IMPL (stupid_STRCHR, 1)
+IMPL (simple_STRCHR, 1)
+IMPL (STRCHR, 1)
+
 static void
-do_one_test (impl_t *impl, const char *s, int c, char *exp_res)
+do_one_test (impl_t *impl, const CHAR *s, int c, const CHAR *exp_res)
 {
-  char *res = CALL (impl, s, c);
+  CHAR *res = CALL (impl, s, c);
   if (res != exp_res)
     {
       error (0, 0, "Wrong result in function %s %p %p", impl->name,
@@ -82,37 +100,40 @@ do_one_test (impl_t *impl, const char *s, int c, 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 */
 {
   size_t i;
-  char *result;
-
-  align &= 7;
-  if (align + len >= page_size)
+  CHAR *result;
+  CHAR *buf = (CHAR *) (buf1);
+  align &= 15;
+  if ((align + len) * sizeof(CHAR) >= page_size)
     return;
 
   for (i = 0; i < len; ++i)
     {
-      buf1[align + i] = 32 + 23 * i % (max_char - 32);
-      if (buf1[align + i] == seek_char)
-        buf1[align + i] = seek_char + 1;
+      buf[align + i] = 32 + 23 * i % max_char;
+      if (buf[align + i] == seek_char)
+        buf[align + i] = seek_char + 1;
     }
-  buf1[align + len] = 0;
+  buf[align + len] = 0;
 
   if (pos < len)
     {
-      buf1[align + pos] = seek_char;
-      result = (char *) (buf1 + align + pos);
+      buf[align + pos] = seek_char;
+      result = buf + align + pos;
     }
   else if (seek_char == 0)
-    result = (char *) (buf1 + align + len);
+    result = buf + align + len;
   else
     result = NULL;
 
   if (HP_TIMING_AVAIL)
-    printf ("Length %4zd, alignment %2zd:", pos, align);
+    printf ("Length %4zd, alignment in bytes %2zd:", pos, align * sizeof (CHAR));
 
   FOR_EACH_IMPL (impl, 0)
-    do_one_test (impl, (char *) (buf1 + align), seek_char, result);
+    do_one_test (impl, buf + align, seek_char, result);
 
   if (HP_TIMING_AVAIL)
     putchar ('\n');
@@ -123,16 +144,19 @@ do_random_tests (void)
 {
   size_t i, j, n, align, pos, len;
   int seek_char;
-  char *result;
-  unsigned char *p = buf1 + page_size - 512;
+  CHAR *result;
+  UCHAR *p = (UCHAR *) (buf1 + page_size - 512 * sizeof (CHAR));
 
   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)) */
       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 = random () & 511;
       if ((pos == len && seek_char)
 	  || (pos > len && (random () & 1)))
@@ -166,18 +190,19 @@ do_random_tests (void)
 	}
 
       if (pos <= len)
-	result = (char *) (p + pos + align);
+	result = (CHAR *) (p + pos + align);
       else if (seek_char == 0)
-	result = (char *) (p + len + align);
+	result = (CHAR *) (p + len + align);
       else
 	result = NULL;
 
       FOR_EACH_IMPL (impl, 1)
-	if (CALL (impl, (char *) (p + align), seek_char) != result)
+	if (CALL (impl, (CHAR *) (p + align), seek_char) != result)
 	  {
-	    error (0, 0, "Iteration %zd - wrong result in function %s (%zd, %d, %zd, %zd) %p != %p, p %p",
-		   n, impl->name, align, seek_char, len, pos,
-		   CALL (impl, (char *) (p + align), seek_char), result, p);
+	    error (0, 0, "Iteration %zd - wrong result in function \
+                   %s (align in bytes: %zd, seek_char: %d, len: %zd, pos: %zd) %p != %p, p %p",
+		   n, impl->name, align * sizeof (CHAR), seek_char, len, pos,
+		   CALL (impl, (CHAR *) (p + align), seek_char), result, p);
 	    ret = 1;
 	  }
     }
@@ -197,38 +222,38 @@ test_main (void)
 
   for (i = 1; i < 8; ++i)
     {
-      do_test (0, 16 << i, 2048, 23, 127);
-      do_test (i, 16 << i, 2048, 23, 127);
+      do_test (0, 16 << i, 2048, SMALL_CHAR, MIDDLE_CHAR);
+      do_test (i, 16 << i, 2048, SMALL_CHAR, MIDDLE_CHAR);
     }
 
   for (i = 1; i < 8; ++i)
     {
-      do_test (i, 64, 256, 23, 127);
-      do_test (i, 64, 256, 23, 255);
+      do_test (i, 64, 256, SMALL_CHAR, MIDDLE_CHAR);
+      do_test (i, 64, 256, SMALL_CHAR, BIG_CHAR);
     }
 
   for (i = 0; i < 32; ++i)
     {
-      do_test (0, i, i + 1, 23, 127);
-      do_test (0, i, i + 1, 23, 255);
+      do_test (0, i, i + 1, SMALL_CHAR, MIDDLE_CHAR);
+      do_test (0, i, i + 1, SMALL_CHAR, BIG_CHAR);
     }
 
   for (i = 1; i < 8; ++i)
     {
-      do_test (0, 16 << i, 2048, 0, 127);
-      do_test (i, 16 << i, 2048, 0, 127);
+      do_test (0, 16 << i, 2048, 0, MIDDLE_CHAR);
+      do_test (i, 16 << i, 2048, 0, MIDDLE_CHAR);
     }
 
   for (i = 1; i < 8; ++i)
     {
-      do_test (i, 64, 256, 0, 127);
-      do_test (i, 64, 256, 0, 255);
+      do_test (i, 64, 256, 0, MIDDLE_CHAR);
+      do_test (i, 64, 256, 0, BIG_CHAR);
     }
 
   for (i = 0; i < 32; ++i)
     {
-      do_test (0, i, i + 1, 0, 127);
-      do_test (0, i, i + 1, 0, 255);
+      do_test (0, i, i + 1, 0, MIDDLE_CHAR);
+      do_test (0, i, i + 1, 0, BIG_CHAR);
     }
 
   do_random_tests ();
diff --git a/wcsmbs/Makefile b/wcsmbs/Makefile
index d48caf6..64d4b22 100644
--- a/wcsmbs/Makefile
+++ b/wcsmbs/Makefile
@@ -42,7 +42,7 @@ routines := wcscat wcschr wcscmp wcscpy wcscspn wcsdup wcslen wcsncat \
 	    isoc99_wscanf isoc99_vwscanf isoc99_fwscanf isoc99_vfwscanf \
 	    isoc99_swscanf isoc99_vswscanf
 
-strop-tests :=  wcscmp wmemcmp wcslen
+strop-tests :=  wcscmp wmemcmp wcslen wcschr
 tests := tst-wcstof wcsmbs-tst1 tst-wcsnlen tst-btowc tst-mbrtowc \
 	 tst-wcrtomb tst-wcpncpy tst-mbsrtowcs tst-wchar-h tst-mbrtowc2 \
 	 wcsatcliff $(addprefix test-,$(strop-tests))
diff --git a/wcsmbs/test-wcschr.c b/wcsmbs/test-wcschr.c
new file mode 100644
index 0000000..be0abf7
--- /dev/null
+++ b/wcsmbs/test-wcschr.c
@@ -0,0 +1,2 @@
+#define WIDE 1
+#include "../string/test-strchr.c"

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

Summary of changes:
 ChangeLog            |   11 +++-
 string/test-strchr.c |  137 +++++++++++++++++++++++++++++--------------------
 wcsmbs/Makefile      |    2 +-
 wcsmbs/test-wcschr.c |    2 +
 4 files changed, 93 insertions(+), 59 deletions(-)
 create mode 100644 wcsmbs/test-wcschr.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]