aboutsummaryrefslogtreecommitdiffstats
path: root/src/search.c
diff options
context:
space:
mode:
authorRichard M. Stallman2004-11-19 20:02:32 +0000
committerRichard M. Stallman2004-11-19 20:02:32 +0000
commitecdb561eb45eb29f45eeb678d26dc570ae3ef876 (patch)
tree97c4eba31068502fd178b330b6c3e34523bceadd /src/search.c
parent65b65d26ef047fa28cad7d30185da64d536c6385 (diff)
downloademacs-ecdb561eb45eb29f45eeb678d26dc570ae3ef876.tar.gz
emacs-ecdb561eb45eb29f45eeb678d26dc570ae3ef876.zip
(struct regexp_cache): New element whitespace_regexp.
(syms_of_search): Initialize whitespace_regexp elements. (compile_pattern): Compare whitespace_regexp elements. (compile_pattern_1): Set whitespace_regexp elements.
Diffstat (limited to 'src/search.c')
-rw-r--r--src/search.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/search.c b/src/search.c
index b73ed338791..d3287ee4c02 100644
--- a/src/search.c
+++ b/src/search.c
@@ -41,7 +41,7 @@ Boston, MA 02111-1307, USA. */
41struct regexp_cache 41struct regexp_cache
42{ 42{
43 struct regexp_cache *next; 43 struct regexp_cache *next;
44 Lisp_Object regexp; 44 Lisp_Object regexp, whitespace_regexp;
45 struct re_pattern_buffer buf; 45 struct re_pattern_buffer buf;
46 char fastmap[0400]; 46 char fastmap[0400];
47 /* Nonzero means regexp was compiled to do full POSIX backtracking. */ 47 /* Nonzero means regexp was compiled to do full POSIX backtracking. */
@@ -109,7 +109,9 @@ matcher_overflow ()
109 for this pattern. 0 means backtrack only enough to get a valid match. 109 for this pattern. 0 means backtrack only enough to get a valid match.
110 MULTIBYTE is nonzero if we want to handle multibyte characters in 110 MULTIBYTE is nonzero if we want to handle multibyte characters in
111 PATTERN. 0 means all multibyte characters are recognized just as 111 PATTERN. 0 means all multibyte characters are recognized just as
112 sequences of binary data. */ 112 sequences of binary data.
113
114 The behavior also depends on Vsearch_whitespace_regexp. */
113 115
114static void 116static void
115compile_pattern_1 (cp, pattern, translate, regp, posix, multibyte) 117compile_pattern_1 (cp, pattern, translate, regp, posix, multibyte)
@@ -160,6 +162,7 @@ compile_pattern_1 (cp, pattern, translate, regp, posix, multibyte)
160 cp->buf.translate = (! NILP (translate) ? translate : make_number (0)); 162 cp->buf.translate = (! NILP (translate) ? translate : make_number (0));
161 cp->posix = posix; 163 cp->posix = posix;
162 cp->buf.multibyte = multibyte; 164 cp->buf.multibyte = multibyte;
165 cp->whitespace_regexp = Vsearch_whitespace_regexp;
163 BLOCK_INPUT; 166 BLOCK_INPUT;
164 old = re_set_syntax (RE_SYNTAX_EMACS 167 old = re_set_syntax (RE_SYNTAX_EMACS
165 | (posix ? 0 : RE_NO_POSIX_BACKTRACKING)); 168 | (posix ? 0 : RE_NO_POSIX_BACKTRACKING));
@@ -232,7 +235,8 @@ compile_pattern (pattern, regp, translate, posix, multibyte)
232 && !NILP (Fstring_equal (cp->regexp, pattern)) 235 && !NILP (Fstring_equal (cp->regexp, pattern))
233 && EQ (cp->buf.translate, (! NILP (translate) ? translate : make_number (0))) 236 && EQ (cp->buf.translate, (! NILP (translate) ? translate : make_number (0)))
234 && cp->posix == posix 237 && cp->posix == posix
235 && cp->buf.multibyte == multibyte) 238 && cp->buf.multibyte == multibyte
239 && !NILP (Fequal (cp->whitespace_regexp, Vsearch_whitespace_regexp)))
236 break; 240 break;
237 241
238 /* 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
@@ -2981,6 +2985,7 @@ syms_of_search ()
2981 searchbufs[i].buf.buffer = (unsigned char *) xmalloc (100); 2985 searchbufs[i].buf.buffer = (unsigned char *) xmalloc (100);
2982 searchbufs[i].buf.fastmap = searchbufs[i].fastmap; 2986 searchbufs[i].buf.fastmap = searchbufs[i].fastmap;
2983 searchbufs[i].regexp = Qnil; 2987 searchbufs[i].regexp = Qnil;
2988 searchbufs[i].whitespace_regexp = Qnil;
2984 staticpro (&searchbufs[i].regexp); 2989 staticpro (&searchbufs[i].regexp);
2985 searchbufs[i].next = (i == REGEXP_CACHE_SIZE-1 ? 0 : &searchbufs[i+1]); 2990 searchbufs[i].next = (i == REGEXP_CACHE_SIZE-1 ? 0 : &searchbufs[i+1]);
2986 } 2991 }