From 5ffaf437c9e3f3cae356631f16ee7c2bf6830202 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Wed, 6 Jan 1999 22:46:20 +0000 Subject: [PATCH] (search_buffer): Fix previous change. --- src/search.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/search.c b/src/search.c index fee6b835bd3..8a67360b549 100644 --- a/src/search.c +++ b/src/search.c @@ -1205,11 +1205,6 @@ search_buffer (string, pos, pos_byte, lim, lim_byte, n, 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 @@ search_buffer (string, pos, pos_byte, lim, lim_byte, n, 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 @@ search_buffer (string, pos, pos_byte, lim, lim_byte, n, { /* 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) -- 2.39.2