emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/src/search.c


From: Kenichi Handa
Subject: [Emacs-diffs] Changes to emacs/src/search.c
Date: Fri, 14 Oct 2005 03:54:50 -0400

Index: emacs/src/search.c
diff -c emacs/src/search.c:1.199 emacs/src/search.c:1.200
*** emacs/src/search.c:1.199    Sun Aug  7 12:33:18 2005
--- emacs/src/search.c  Fri Oct 14 07:54:50 2005
***************
*** 1175,1183 ****
        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;
        int boyer_moore_ok = 1;
  
        /* MULTIBYTE says whether the text to be searched is multibyte.
--- 1175,1183 ----
        unsigned char *patbuf;
        int multibyte = !NILP (current_buffer->enable_multibyte_characters);
        unsigned char *base_pat = SDATA (string);
!       /* 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,1298 ****
                         always handle their translation.  */
                      while (1)
                        {
!                         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)
                                {
                                  boyer_moore_ok = 0;
                                  break;
                                }
                            }
                          if (c == inverse)
                            break;
--- 1275,1304 ----
                         always handle their translation.  */
                      while (1)
                        {
!                         if (ASCII_BYTE_P (inverse))
                            {
!                             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,1305 ****
--- 1306,1313 ----
                        }
                    }
                }
+             if (charset_base < 0)
+               charset_base = 0;
  
              /* Store this character into the translated pattern.  */
              bcopy (str, pat, charlen);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]