This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


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

[PATCH] Fix a thinko in tst-rxspencer


Hi!

In the patch posted yesterday I made a thinko in tst-rxspencer,
rather than not running unnecessary tests, I just skipped replacing
characters which were not present at all.
The following patch on top of that should really only run tests
where something not yet tested can be checked.

2003-11-21  Jakub Jelinek  <jakub@redhat.com>

	* posix/tst-rxspencer.c (mb_tests): Don't run identical multi-byte
	tests multiple times unnecessarily.

--- libc/posix/tst-rxspencer.c.jj	2003-11-20 14:56:22.000000000 +0100
+++ libc/posix/tst-rxspencer.c	2003-11-21 01:17:00.000000000 +0100
@@ -357,22 +357,34 @@ mb_tests (const char *pattern, int cflag
   for (i = 1; i < 16; ++i)
     {
       char *p = letters;
-      if ((i & 1)
-	  && (strchr (pattern, 'a') || strchr (string, 'a')
-	      || strchr (pattern, 'A') || strchr (string, 'A')))
-	*p++ = 'a', *p++ = 'A';
-      if ((i & 2)
-	  && (strchr (pattern, 'b') || strchr (string, 'b')
-	      || strchr (pattern, 'B') || strchr (string, 'B')))
-        *p++ = 'b', *p++ = 'B';
-      if ((i & 4)
-	  && (strchr (pattern, 'c') || strchr (string, 'c')
-	      || strchr (pattern, 'C') || strchr (string, 'C')))
-        *p++ = 'c', *p++ = 'C';
-      if ((i & 8)
-	  && (strchr (pattern, 'd') || strchr (string, 'd')
-	      || strchr (pattern, 'D') || strchr (string, 'D')))
-        *p++ = 'd', *p++ = 'D';
+      if (i & 1)
+	{
+	  if (!strchr (pattern, 'a') && !strchr (string, 'a')
+	      && !strchr (pattern, 'A') && !strchr (string, 'A'))
+	    continue;
+	  *p++ = 'a', *p++ = 'A';
+	}
+      if (i & 2)
+	{
+	  if (!strchr (pattern, 'b') && !strchr (string, 'b')
+	      && !strchr (pattern, 'B') && !strchr (string, 'B'))
+	    continue;
+	  *p++ = 'b', *p++ = 'B';
+	}
+      if (i & 4)
+	{
+	  if (!strchr (pattern, 'c') && !strchr (string, 'c')
+	      && !strchr (pattern, 'C') && !strchr (string, 'C'))
+	    continue;
+	  *p++ = 'c', *p++ = 'C';
+	}
+      if (i & 8)
+	{
+	  if (!strchr (pattern, 'd') && !strchr (string, 'd')
+	      && !strchr (pattern, 'D') && !strchr (string, 'D'))
+	    continue;
+	  *p++ = 'd', *p++ = 'D';
+	}
       *p++ = '\0';
       sprintf (fail, "UTF-8 %s FAIL", letters);
       ret |= mb_test (pattern, cflags, string, eflags, expect, matches,


	Jakub


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