about summary refs log tree commit diff
path: root/posix/regex.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-08-23 17:31:46 +0000
committerUlrich Drepper <drepper@redhat.com>1999-08-23 17:31:46 +0000
commit539491ac15da9e1ad61606aa4b4b8f80c04f81ff (patch)
treee2dc300ab25d15702dfaa54e31e3f82f2f2492b6 /posix/regex.c
parenta286028236801749fbdc42473c8dca8c1c233508 (diff)
downloadglibc-539491ac15da9e1ad61606aa4b4b8f80c04f81ff.tar.gz
glibc-539491ac15da9e1ad61606aa4b4b8f80c04f81ff.tar.xz
glibc-539491ac15da9e1ad61606aa4b4b8f80c04f81ff.zip
Update.
Diffstat (limited to 'posix/regex.c')
-rw-r--r--posix/regex.c24
1 files changed, 8 insertions, 16 deletions
diff --git a/posix/regex.c b/posix/regex.c
index 1bd01911f5..16e91f1514 100644
--- a/posix/regex.c
+++ b/posix/regex.c
@@ -4833,23 +4833,15 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop)
 	      }
             else if ((re_opcode_t) *p2 == charset)
 	      {
-                if ((re_opcode_t) p1[3] == exactn)
+		/* We win if the first character of the loop is not part
+                   of the charset.  */
+                if ((re_opcode_t) p1[3] == exactn
+ 		    && ! ((int) p2[1] * BYTEWIDTH > (int) p1[5]
+ 			  && (p2[2 + p1[5] / BYTEWIDTH]
+ 			      & (1 << (p1[5] % BYTEWIDTH)))))
 		  {
-		    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;
-		      }
+		    p[-3] = (unsigned char) pop_failure_jump;
+		    DEBUG_PRINT1 ("  No match => pop_failure_jump.\n");
                   }
 
 		else if ((re_opcode_t) p1[3] == charset_not)