comparison src/search.c @ 24014:0997bcfd8827

(search_buffer): Fix previous change.
author Richard M. Stallman <rms@gnu.org>
date Wed, 06 Jan 1999 22:46:20 +0000
parents 8d2f38338c81
children 118e66d79d64
comparison
equal deleted inserted replaced
24013:2f040734bd5f 24014:0997bcfd8827
1203 base_pat++; 1203 base_pat++;
1204 } 1204 }
1205 1205
1206 c = STRING_CHAR_AND_LENGTH (base_pat, len_byte, in_charlen); 1206 c = STRING_CHAR_AND_LENGTH (base_pat, len_byte, in_charlen);
1207 1207
1208 /* If we are searching for something strange,
1209 an invalid multibyte code, don't use boyer-moore. */
1210 if (! ASCII_BYTE_P (c))
1211 boyer_moore_ok = 0;
1212
1213 /* Translate the character, if requested. */ 1208 /* Translate the character, if requested. */
1214 TRANSLATE (translated, trt, c); 1209 TRANSLATE (translated, trt, c);
1215 /* If translation changed the byte-length, go back 1210 /* If translation changed the byte-length, go back
1216 to the original character. */ 1211 to the original character. */
1217 charlen = CHAR_STRING (translated, workbuf, str); 1212 charlen = CHAR_STRING (translated, workbuf, str);
1219 { 1214 {
1220 translated = c; 1215 translated = c;
1221 charlen = CHAR_STRING (c, workbuf, str); 1216 charlen = CHAR_STRING (c, workbuf, str);
1222 } 1217 }
1223 1218
1219 /* If we are searching for something strange,
1220 an invalid multibyte code, don't use boyer-moore. */
1221 if (! ASCII_BYTE_P (translated)
1222 && (charlen == 1 /* 8bit code */
1223 || charlen != in_charlen /* invalid multibyte code */
1224 ))
1225 boyer_moore_ok = 0;
1226
1224 TRANSLATE (inverse, inverse_trt, c); 1227 TRANSLATE (inverse, inverse_trt, c);
1225 1228
1226 /* Did this char actually get translated? 1229 /* Did this char actually get translated?
1227 Would any other char get translated into it? */ 1230 Would any other char get translated into it? */
1228 if (translated != c || inverse != c) 1231 if (translated != c || inverse != c)
1229 { 1232 {
1230 /* Keep track of which character set row 1233 /* Keep track of which character set row
1231 contains the characters that need translation. */ 1234 contains the characters that need translation. */
1232 int charset_base_code = c & ~0xff; 1235 int charset_base_code = c & ~CHAR_FIELD3_MASK;
1233 if (charset_base == -1) 1236 if (charset_base == -1)
1234 charset_base = charset_base_code; 1237 charset_base = charset_base_code;
1235 else if (charset_base != charset_base_code) 1238 else if (charset_base != charset_base_code)
1236 /* If two different rows appear, needing translation, 1239 /* If two different rows appear, needing translation,
1237 then we cannot use boyer_moore search. */ 1240 then we cannot use boyer_moore search. */