aboutsummaryrefslogtreecommitdiffstats
path: root/src/search.c
diff options
context:
space:
mode:
authorKenichi Handa <[email protected]>2007-02-15 11:26:52 +0000
committerKenichi Handa <[email protected]>2007-02-15 11:26:52 +0000
commit89ad649268900b3137a01d6c888f8a156f2cf792 (patch)
tree1d3e22714e71504403223d32ed09b8c125d75508 /src/search.c
parent0b4b4d2e6d222224e317a1e47f4cecb191919305 (diff)
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.
Diffstat (limited to 'src/search.c')
-rw-r--r--src/search.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/search.c b/src/search.c
index 2e4ddc3256..7f50032c02 100644
--- a/src/search.c
+++ b/src/search.c
@@ -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;
}