summary refs log tree commit diff
path: root/posix
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-08-23 16:54:35 +0000
committerUlrich Drepper <drepper@redhat.com>1999-08-23 16:54:35 +0000
commita286028236801749fbdc42473c8dca8c1c233508 (patch)
treef2db9e5a4269762ad44e264f66c00350006e3ba8 /posix
parentc107ccd460c7153bce5d762a52c38cdf5e0ead88 (diff)
downloadglibc-a286028236801749fbdc42473c8dca8c1c233508.tar.gz
glibc-a286028236801749fbdc42473c8dca8c1c233508.tar.xz
glibc-a286028236801749fbdc42473c8dca8c1c233508.zip
Update.
1999-08-23  Ulrich Drepper  <drepper@cygnus.com>

	* posix/regexbug1.c: Make it an error if the test fails.

1999-08-23  Andreas Schwab  <schwab@suse.de>
	    Ulrich Drepper  <drepper@cygnus.com>

	* posix/regex.c (re_match_2_internal): Correct check for charset
	after exactn in loop.
Diffstat (limited to 'posix')
-rw-r--r--posix/regex.c37
-rw-r--r--posix/regexbug1.c5
2 files changed, 19 insertions, 23 deletions
diff --git a/posix/regex.c b/posix/regex.c
index 99cf4c31a7..1bd01911f5 100644
--- a/posix/regex.c
+++ b/posix/regex.c
@@ -4833,26 +4833,23 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop)
 	      }
             else if ((re_opcode_t) *p2 == charset)
 	      {
-#ifdef DEBUG
-		register unsigned char c
-                  = *p2 == (unsigned char) endline ? '\n' : p2[2];
-#endif
-
-#if 0
-                if ((re_opcode_t) p1[3] == exactn
-		    && ! ((int) p2[1] * BYTEWIDTH > (int) p1[5]
-			  && (p2[2 + p1[5] / BYTEWIDTH]
-			      & (1 << (p1[5] % BYTEWIDTH)))))
-#else
-                if ((re_opcode_t) p1[3] == exactn
-		    && ! ((int) p2[1] * BYTEWIDTH > (int) p1[4]
-			  && (p2[2 + p1[4] / BYTEWIDTH]
-			      & (1 << (p1[4] % BYTEWIDTH)))))
-#endif
-                  {
-  		    p[-3] = (unsigned char) pop_failure_jump;
-                    DEBUG_PRINT3 ("  %c != %c => pop_failure_jump.\n",
-                                  c, p1[5]);
+                if ((re_opcode_t) p1[3] == exactn)
+		  {
+		    unsigned char *p1end = &p1[5] + p1[4];
+		    unsigned char *runp1 = &p1[5];
+
+		    while (runp1 < p1end)
+		      {
+			if ((int) p2[1] * BYTEWIDTH <= (int) *runp1
+			    || (p2[2 + *runp1 / BYTEWIDTH]
+				& (1 << (*runp1 % BYTEWIDTH))) == 0)
+			  {
+			    p[-3] = (unsigned char) pop_failure_jump;
+			    DEBUG_PRINT1 ("  No match => pop_failure_jump.\n");
+			    break;
+			  }
+			++runp1;
+		      }
                   }
 
 		else if ((re_opcode_t) p1[3] == charset_not)
diff --git a/posix/regexbug1.c b/posix/regexbug1.c
index 6f7f995f57..8ab0bc0e6c 100644
--- a/posix/regexbug1.c
+++ b/posix/regexbug1.c
@@ -23,9 +23,8 @@ main (void)
   if (regexec (&re, "002", 2, ma, 0) != 0)
     {
       error (0, 0, "\"0*[0-9][0-9]\" did not match \"002\"");
-      /* Comment the following line out until the bug is fixed.  */
-      //res = 1;
+      res = 1;
     }
 
-  return 0;
+  return res;
 }