]> git.eshelyaron.com Git - emacs.git/commitdiff
Include "charset.h".
authorKenichi Handa <handa@m17n.org>
Thu, 15 Feb 2007 11:26:52 +0000 (11:26 +0000)
committerKenichi Handa <handa@m17n.org>
Thu, 15 Feb 2007 11:26:52 +0000 (11:26 +0000)
(compile_pattern_1): Delete argument multibyte.  Don't set
cp->buf.target_multibyte here.  Set cp->buf.charset_unibyte.
(compile_pattern): Don't compare cp->buf.target_multibyte.
Compare cp->buf.charset_unibyte.
(compile_pattern): Set cp->buf.target_multibyte.

src/search.c

index 2e4ddc3256d5369037fc590cd416155201bbb077..7f50032c0249f43969eda90f09b402bbd8f52a6f 100644 (file)
@@ -26,6 +26,7 @@ Boston, MA 02110-1301, USA.  */
 #include "category.h"
 #include "buffer.h"
 #include "character.h"
+#include "charset.h"
 #include "region-cache.h"
 #include "commands.h"
 #include "blockinput.h"
@@ -115,19 +116,16 @@ matcher_overflow ()
    subexpression bounds.
    POSIX is nonzero if we want full backtracking (POSIX style)
    for this pattern.  0 means backtrack only enough to get a valid match.
-   MULTIBYTE is nonzero iff a target of match is a multibyte buffer or
-   string.
 
    The behavior also depends on Vsearch_spaces_regexp.  */
 
 static void
-compile_pattern_1 (cp, pattern, translate, regp, posix, multibyte)
+compile_pattern_1 (cp, pattern, translate, regp, posix)
      struct regexp_cache *cp;
      Lisp_Object pattern;
      Lisp_Object translate;
      struct re_registers *regp;
      int posix;
-     int multibyte;
 {
   char *val;
   reg_syntax_t old;
@@ -136,7 +134,7 @@ compile_pattern_1 (cp, pattern, translate, regp, posix, multibyte)
   cp->buf.translate = (! NILP (translate) ? translate : make_number (0));
   cp->posix = posix;
   cp->buf.multibyte = STRING_MULTIBYTE (pattern);
-  cp->buf.target_multibyte = multibyte;
+  cp->buf.charset_unibyte = charset_unibyte;
   cp->whitespace_regexp = Vsearch_spaces_regexp;
   /* rms: I think BLOCK_INPUT is not needed here any more,
      because regex.c defines malloc to call xmalloc.
@@ -235,10 +233,10 @@ compile_pattern (pattern, regp, translate, posix, multibyte)
          && !NILP (Fstring_equal (cp->regexp, pattern))
          && EQ (cp->buf.translate, (! NILP (translate) ? translate : make_number (0)))
          && cp->posix == posix
-         && cp->buf.target_multibyte == multibyte
          && (EQ (cp->syntax_table, Qt)
              || EQ (cp->syntax_table, current_buffer->syntax_table))
-         && !NILP (Fequal (cp->whitespace_regexp, Vsearch_spaces_regexp)))
+         && !NILP (Fequal (cp->whitespace_regexp, Vsearch_spaces_regexp))
+         && cp->buf.charset_unibyte == charset_unibyte)
        break;
 
       /* If we're at the end of the cache, compile into the nil cell
@@ -247,7 +245,7 @@ compile_pattern (pattern, regp, translate, posix, multibyte)
       if (cp->next == 0)
        {
        compile_it:
-         compile_pattern_1 (cp, pattern, translate, regp, posix, multibyte);
+         compile_pattern_1 (cp, pattern, translate, regp, posix);
          break;
        }
     }
@@ -264,6 +262,10 @@ compile_pattern (pattern, regp, translate, posix, multibyte)
   if (regp)
     re_set_registers (&cp->buf, regp, regp->num_regs, regp->start, regp->end);
 
+  /* The compiled pattern can be used both for mulitbyte and unibyte
+     target.  But, we have to tell which the pattern is used for. */
+  cp->buf.target_multibyte = multibyte;
+
   return &cp->buf;
 }