[PATCH] Fix a thinko in tst-rxspencer

Jakub Jelinek jakub@redhat.com
Fri Nov 21 00:28:00 GMT 2003


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



More information about the Libc-hacker mailing list