changeset 90760:656ca684d326

Include "charset.h". (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.
author Kenichi Handa <handa@m17n.org>
date Thu, 15 Feb 2007 11:26:52 +0000
parents a5e47ab2fa2a
children 2951f3d44eba
files src/search.c
diffstat 1 files changed, 10 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/search.c	Thu Feb 15 11:24:51 2007 +0000
+++ b/src/search.c	Thu Feb 15 11:26:52 2007 +0000
@@ -26,6 +26,7 @@
 #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 @@
    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 @@
   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 @@
 	  && !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 @@
       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 @@
   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;
 }