changeset 93006:72213c342fe7

(re_match_2_internal): Correct matching of a charset against latin-1 characters.
author Andreas Schwab <schwab@suse.de>
date Sun, 16 Mar 2008 10:45:53 +0000
parents e947a4888267
children 37e19c40840b
files src/ChangeLog src/regex.c
diffstat 2 files changed, 17 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Sun Mar 16 09:24:29 2008 +0000
+++ b/src/ChangeLog	Sun Mar 16 10:45:53 2008 +0000
@@ -1,3 +1,8 @@
+2008-03-16  Andreas Schwab  <schwab@suse.de>
+
+	* regex.c (re_match_2_internal): Correct matching of a charset
+	against latin-1 characters.
+
 2008-03-16  Kenichi Handa  <handa@m17n.org>
 
 	* coding.c (CHAR_STRING_ADVANCE_NO_UNIFY)
--- a/src/regex.c	Sun Mar 16 09:24:29 2008 +0000
+++ b/src/regex.c	Sun Mar 16 10:45:53 2008 +0000
@@ -5648,6 +5648,9 @@
 	       in the initial byte-length of the command.  */
 	    int count = 0;
 
+	    /* Whether matching against a unibyte character.  */
+	    boolean unibyte_char = false;
+
 	    DEBUG_PRINT2 ("EXECUTING charset%s.\n", not ? "_not" : "");
 
 	    range_table_exists = CHARSET_RANGE_TABLE_EXISTS_P (&p[-1]);
@@ -5667,7 +5670,10 @@
 		c = TRANSLATE (c);
 		c1 = RE_CHAR_TO_UNIBYTE (c);
 		if (c1 >= 0)
-		  c = c1;
+		  {
+		    unibyte_char = true;
+		    c = c1;
+		  }
 	      }
 	    else
 	      {
@@ -5678,11 +5684,14 @@
 		    c1 = TRANSLATE (c1);
 		    c1 = RE_CHAR_TO_UNIBYTE (c1);
 		    if (c1 >= 0)
-		      c = c1;
+		      {
+			unibyte_char = true;
+			c = c1;
+		      }
 		  }
 	      }
 
-	    if (c < (1 << BYTEWIDTH))
+	    if (unibyte_char && c < (1 << BYTEWIDTH))
 	      {			/* Lookup bitmap.  */
 		/* Cast to `unsigned' instead of `unsigned char' in
 		   case the bit list is a full 32 bytes long.  */