]> code.delx.au - gnu-emacs/commitdiff
(search_buffer): Give up BM search on case-fold-search
authorKenichi Handa <handa@m17n.org>
Fri, 14 Oct 2005 07:55:05 +0000 (07:55 +0000)
committerKenichi Handa <handa@m17n.org>
Fri, 14 Oct 2005 07:55:05 +0000 (07:55 +0000)
if one of a target character has a case-equivalence of different
charset even if that target charcter is an ASCII.

src/ChangeLog
src/search.c

index 30db05481725a5b976d4ac25c975f07e1515cd27..6c63a3cd20bb7db836aae7219fb140f5a3db7623 100644 (file)
@@ -1,3 +1,12 @@
+2005-10-14  Kenichi Handa  <handa@m17n.org>
+
+       * search.c (search_buffer): Give up BM search on case-fold-search
+       if one of a target character has a case-equivalence of different
+       charset even if that target charcter is an ASCII.
+
+       * casefiddle.c (casify_object): Fix for the case that case
+       conversion change the byte length.
+
 2005-10-14  Kim F. Storm  <storm@cua.dk>
 
        * xterm.c (note_mouse_movement): Return 1 if mouse moved; 0 otherwise.
index aa7f6fda699a482b5be7a0ba94be2baa036c8799..f60e6d0cfe2ac263a0a5ba026f4255c2cf2ca966 100644 (file)
@@ -1175,9 +1175,9 @@ search_buffer (string, pos, pos_byte, lim, lim_byte, n,
       unsigned char *patbuf;
       int multibyte = !NILP (current_buffer->enable_multibyte_characters);
       unsigned char *base_pat = SDATA (string);
-      /* Set to nozero if we find a non-ASCII char that need
-        translation.  */
-      int charset_base = 0;
+      /* Set to positive if we find a non-ASCII char that need
+        translation.  Otherwise set to zero later.  */
+      int charset_base = -1;
       int boyer_moore_ok = 1;
 
       /* MULTIBYTE says whether the text to be searched is multibyte.
@@ -1275,24 +1275,30 @@ search_buffer (string, pos, pos_byte, lim, lim_byte, n,
                         always handle their translation.  */
                      while (1)
                        {
-                         if (ASCII_BYTE_P (inverse))
+                         if (ASCII_BYTE_P (inverse))
                            {
-                             if (SINGLE_BYTE_CHAR_P (inverse))
-                               {
-                                 /* Boyer-moore search can't handle a
-                                    translation of an eight-bit
-                                    character.  */
-                                 boyer_moore_ok = 0;
-                                 break;
-                               }
-                             else if (charset_base == 0)
-                               charset_base = inverse & ~CHAR_FIELD3_MASK;
-                             else if ((inverse & ~CHAR_FIELD3_MASK)
-                                      != charset_base)
+                             if (charset_base > 0)
                                {
                                  boyer_moore_ok = 0;
                                  break;
                                }
+                             charset_base = 0;
+                           }
+                         else if (SINGLE_BYTE_CHAR_P (inverse))
+                           {
+                             /* Boyer-moore search can't handle a
+                                translation of an eight-bit
+                                character.  */
+                             boyer_moore_ok = 0;
+                             break;
+                           }
+                         else if (charset_base < 0)
+                           charset_base = inverse & ~CHAR_FIELD3_MASK;
+                         else if ((inverse & ~CHAR_FIELD3_MASK)
+                                  != charset_base)
+                           {
+                             boyer_moore_ok = 0;
+                             break;
                            }
                          if (c == inverse)
                            break;
@@ -1300,6 +1306,8 @@ search_buffer (string, pos, pos_byte, lim, lim_byte, n,
                        }
                    }
                }
+             if (charset_base < 0)
+               charset_base = 0;
 
              /* Store this character into the translated pattern.  */
              bcopy (str, pat, charlen);