changeset 89176:729d852f7419

(re_search_2): Fix for the case of unibyte buffer.
author Kenichi Handa <handa@m17n.org>
date Mon, 07 Oct 2002 12:58:29 +0000
parents adc5b06c6722
children 8b81c54139ef
files src/regex.c
diffstat 1 files changed, 20 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/regex.c	Mon Oct 07 12:57:40 2002 +0000
+++ b/src/regex.c	Mon Oct 07 12:58:29 2002 +0000
@@ -4099,13 +4099,26 @@
 	      int room = (startpos >= size1
 			  ? size2 + size1 - startpos
 			  : size1 - startpos);
-	      buf_ch = RE_STRING_CHAR (d, room);
-	      if (! target_multibyte)
-		MAKE_CHAR_MULTIBYTE (buf_ch);
-	      buf_ch = TRANSLATE (buf_ch);
-
-	      if (! fastmap[CHAR_LEADING_CODE (buf_ch)])
-		goto advance;
+
+	      if (multibyte)
+		{
+		  /* Case of Emacs.  */
+		  if (target_multibyte)
+		    buf_ch = RE_STRING_CHAR (d, room);
+		  else
+		    {
+		      buf_ch = *d;
+		      MAKE_CHAR_MULTIBYTE (buf_ch);
+		    }
+		  buf_ch = TRANSLATE (buf_ch);
+		  if (! fastmap[CHAR_LEADING_CODE (buf_ch)])
+		    goto advance;
+		}
+	      else
+		{
+		  if (! fastmap[TRANSLATE (*d)])
+		    goto advance;
+		}
 	    }
 	}