diff options
| author | Kenichi Handa | 2007-02-15 11:26:52 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2007-02-15 11:26:52 +0000 |
| commit | 89ad649268900b3137a01d6c888f8a156f2cf792 (patch) | |
| tree | 1d3e22714e71504403223d32ed09b8c125d75508 /src | |
| parent | 0b4b4d2e6d222224e317a1e47f4cecb191919305 (diff) | |
| download | emacs-89ad649268900b3137a01d6c888f8a156f2cf792.tar.gz emacs-89ad649268900b3137a01d6c888f8a156f2cf792.zip | |
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')
| -rw-r--r-- | src/search.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/search.c b/src/search.c index 2e4ddc3256d..7f50032c024 100644 --- a/src/search.c +++ b/src/search.c | |||
| @@ -26,6 +26,7 @@ Boston, MA 02110-1301, USA. */ | |||
| 26 | #include "category.h" | 26 | #include "category.h" |
| 27 | #include "buffer.h" | 27 | #include "buffer.h" |
| 28 | #include "character.h" | 28 | #include "character.h" |
| 29 | #include "charset.h" | ||
| 29 | #include "region-cache.h" | 30 | #include "region-cache.h" |
| 30 | #include "commands.h" | 31 | #include "commands.h" |
| 31 | #include "blockinput.h" | 32 | #include "blockinput.h" |
| @@ -115,19 +116,16 @@ matcher_overflow () | |||
| 115 | subexpression bounds. | 116 | subexpression bounds. |
| 116 | POSIX is nonzero if we want full backtracking (POSIX style) | 117 | POSIX is nonzero if we want full backtracking (POSIX style) |
| 117 | for this pattern. 0 means backtrack only enough to get a valid match. | 118 | for this pattern. 0 means backtrack only enough to get a valid match. |
| 118 | MULTIBYTE is nonzero iff a target of match is a multibyte buffer or | ||
| 119 | string. | ||
| 120 | 119 | ||
| 121 | The behavior also depends on Vsearch_spaces_regexp. */ | 120 | The behavior also depends on Vsearch_spaces_regexp. */ |
| 122 | 121 | ||
| 123 | static void | 122 | static void |
| 124 | compile_pattern_1 (cp, pattern, translate, regp, posix, multibyte) | 123 | compile_pattern_1 (cp, pattern, translate, regp, posix) |
| 125 | struct regexp_cache *cp; | 124 | struct regexp_cache *cp; |
| 126 | Lisp_Object pattern; | 125 | Lisp_Object pattern; |
| 127 | Lisp_Object translate; | 126 | Lisp_Object translate; |
| 128 | struct re_registers *regp; | 127 | struct re_registers *regp; |
| 129 | int posix; | 128 | int posix; |
| 130 | int multibyte; | ||
| 131 | { | 129 | { |
| 132 | char *val; | 130 | char *val; |
| 133 | reg_syntax_t old; | 131 | reg_syntax_t old; |
| @@ -136,7 +134,7 @@ compile_pattern_1 (cp, pattern, translate, regp, posix, multibyte) | |||
| 136 | cp->buf.translate = (! NILP (translate) ? translate : make_number (0)); | 134 | cp->buf.translate = (! NILP (translate) ? translate : make_number (0)); |
| 137 | cp->posix = posix; | 135 | cp->posix = posix; |
| 138 | cp->buf.multibyte = STRING_MULTIBYTE (pattern); | 136 | cp->buf.multibyte = STRING_MULTIBYTE (pattern); |
| 139 | cp->buf.target_multibyte = multibyte; | 137 | cp->buf.charset_unibyte = charset_unibyte; |
| 140 | cp->whitespace_regexp = Vsearch_spaces_regexp; | 138 | cp->whitespace_regexp = Vsearch_spaces_regexp; |
| 141 | /* rms: I think BLOCK_INPUT is not needed here any more, | 139 | /* rms: I think BLOCK_INPUT is not needed here any more, |
| 142 | because regex.c defines malloc to call xmalloc. | 140 | because regex.c defines malloc to call xmalloc. |
| @@ -235,10 +233,10 @@ compile_pattern (pattern, regp, translate, posix, multibyte) | |||
| 235 | && !NILP (Fstring_equal (cp->regexp, pattern)) | 233 | && !NILP (Fstring_equal (cp->regexp, pattern)) |
| 236 | && EQ (cp->buf.translate, (! NILP (translate) ? translate : make_number (0))) | 234 | && EQ (cp->buf.translate, (! NILP (translate) ? translate : make_number (0))) |
| 237 | && cp->posix == posix | 235 | && cp->posix == posix |
| 238 | && cp->buf.target_multibyte == multibyte | ||
| 239 | && (EQ (cp->syntax_table, Qt) | 236 | && (EQ (cp->syntax_table, Qt) |
| 240 | || EQ (cp->syntax_table, current_buffer->syntax_table)) | 237 | || EQ (cp->syntax_table, current_buffer->syntax_table)) |
| 241 | && !NILP (Fequal (cp->whitespace_regexp, Vsearch_spaces_regexp))) | 238 | && !NILP (Fequal (cp->whitespace_regexp, Vsearch_spaces_regexp)) |
| 239 | && cp->buf.charset_unibyte == charset_unibyte) | ||
| 242 | break; | 240 | break; |
| 243 | 241 | ||
| 244 | /* If we're at the end of the cache, compile into the nil cell | 242 | /* 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) | |||
| 247 | if (cp->next == 0) | 245 | if (cp->next == 0) |
| 248 | { | 246 | { |
| 249 | compile_it: | 247 | compile_it: |
| 250 | compile_pattern_1 (cp, pattern, translate, regp, posix, multibyte); | 248 | compile_pattern_1 (cp, pattern, translate, regp, posix); |
| 251 | break; | 249 | break; |
| 252 | } | 250 | } |
| 253 | } | 251 | } |
| @@ -264,6 +262,10 @@ compile_pattern (pattern, regp, translate, posix, multibyte) | |||
| 264 | if (regp) | 262 | if (regp) |
| 265 | re_set_registers (&cp->buf, regp, regp->num_regs, regp->start, regp->end); | 263 | re_set_registers (&cp->buf, regp, regp->num_regs, regp->start, regp->end); |
| 266 | 264 | ||
| 265 | /* The compiled pattern can be used both for mulitbyte and unibyte | ||
| 266 | target. But, we have to tell which the pattern is used for. */ | ||
| 267 | cp->buf.target_multibyte = multibyte; | ||
| 268 | |||
| 267 | return &cp->buf; | 269 | return &cp->buf; |
| 268 | } | 270 | } |
| 269 | 271 | ||