changeset 24014:0997bcfd8827

(search_buffer): Fix previous change.
author Richard M. Stallman <rms@gnu.org>
date Wed, 06 Jan 1999 22:46:20 +0000
parents 2f040734bd5f
children 2b8d4cd758b7
files src/search.c
diffstat 1 files changed, 9 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/search.c	Wed Jan 06 20:03:53 1999 +0000
+++ b/src/search.c	Wed Jan 06 22:46:20 1999 +0000
@@ -1205,11 +1205,6 @@
 
 	      c = STRING_CHAR_AND_LENGTH (base_pat, len_byte, in_charlen);
 
-	      /* If we are searching for something strange,
-		 an invalid multibyte code, don't use boyer-moore.  */
-	      if (! ASCII_BYTE_P (c))
-		boyer_moore_ok = 0;
-
 	      /* Translate the character, if requested.  */
 	      TRANSLATE (translated, trt, c);
 	      /* If translation changed the byte-length, go back
@@ -1221,6 +1216,14 @@
 		  charlen = CHAR_STRING (c, workbuf, str);
 		}
 
+	      /* If we are searching for something strange,
+		 an invalid multibyte code, don't use boyer-moore.  */
+	      if (! ASCII_BYTE_P (translated)
+		  && (charlen == 1 /* 8bit code */
+		      || charlen != in_charlen /* invalid multibyte code */
+		      ))
+		boyer_moore_ok = 0;
+
 	      TRANSLATE (inverse, inverse_trt, c);
 
 	      /* Did this char actually get translated?
@@ -1229,7 +1232,7 @@
 		{
 		  /* Keep track of which character set row
 		     contains the characters that need translation.  */
-		  int charset_base_code = c & ~0xff;
+		  int charset_base_code = c & ~CHAR_FIELD3_MASK;
 		  if (charset_base == -1)
 		    charset_base = charset_base_code;
 		  else if (charset_base != charset_base_code)