aboutsummaryrefslogtreecommitdiffstats
path: root/src/search.c
diff options
context:
space:
mode:
authorMichal Nazarewicz2016-07-27 22:53:57 +0200
committerMichal Nazarewicz2016-08-02 15:39:10 +0200
commitda9c55ddbbd08fc07ab36dc8bdc740e352eeab2c (patch)
tree597b4d4f7e7a0d784e26b5f114a035b4c068e1f0 /src/search.c
parent04d96eca08ff797c0cd93c33fe8589f4623fc449 (diff)
downloademacs-da9c55ddbbd08fc07ab36dc8bdc740e352eeab2c.tar.gz
emacs-da9c55ddbbd08fc07ab36dc8bdc740e352eeab2c.zip
Get rid of re_set_whitespace_regexp
* src/regex.h (re_set_whitespace_regexp): Delete. (re_compile_pattern): Add whitespace_regexp argument #ifdef emacs. * src/regex.c (re_set_whitespace_regexp, whitespace_regexp): Delete. (regex_compile): Add whitespace_regexp argument #ifdef emacs and wrap whitespace_regexp-related code in an #ifdef emacs so it’s compiled out unless building Emacs. (re_compile_pattern): Pass whitespace_regexp argument to regex_compile * src/search.c (compile_pattern_1): Don’t use re_set_whitespace_regexp, pass the regex as argument to re_compile_pattern instead.
Diffstat (limited to 'src/search.c')
-rw-r--r--src/search.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/search.c b/src/search.c
index f0419522df2..c7556a90cb4 100644
--- a/src/search.c
+++ b/src/search.c
@@ -113,6 +113,7 @@ static void
113compile_pattern_1 (struct regexp_cache *cp, Lisp_Object pattern, 113compile_pattern_1 (struct regexp_cache *cp, Lisp_Object pattern,
114 Lisp_Object translate, bool posix) 114 Lisp_Object translate, bool posix)
115{ 115{
116 const char *whitespace_regexp;
116 reg_syntax_t syntax; 117 reg_syntax_t syntax;
117 char *val; 118 char *val;
118 119
@@ -132,21 +133,17 @@ compile_pattern_1 (struct regexp_cache *cp, Lisp_Object pattern,
132 So let's turn it off. */ 133 So let's turn it off. */
133 /* BLOCK_INPUT; */ 134 /* BLOCK_INPUT; */
134 135
135 if (STRINGP (Vsearch_spaces_regexp))
136 re_set_whitespace_regexp (SSDATA (Vsearch_spaces_regexp));
137 else
138 re_set_whitespace_regexp (NULL);
139
140 syntax = RE_SYNTAX_EMACS | (posix ? 0 : RE_NO_POSIX_BACKTRACKING); 136 syntax = RE_SYNTAX_EMACS | (posix ? 0 : RE_NO_POSIX_BACKTRACKING);
137 whitespace_regexp = STRINGP (Vsearch_spaces_regexp) ?
138 SSDATA (Vsearch_spaces_regexp) : NULL;
139
141 val = (char *) re_compile_pattern (SSDATA (pattern), SBYTES (pattern), 140 val = (char *) re_compile_pattern (SSDATA (pattern), SBYTES (pattern),
142 syntax, &cp->buf); 141 syntax, whitespace_regexp, &cp->buf);
143 142
144 /* If the compiled pattern hard codes some of the contents of the 143 /* If the compiled pattern hard codes some of the contents of the
145 syntax-table, it can only be reused with *this* syntax table. */ 144 syntax-table, it can only be reused with *this* syntax table. */
146 cp->syntax_table = cp->buf.used_syntax ? BVAR (current_buffer, syntax_table) : Qt; 145 cp->syntax_table = cp->buf.used_syntax ? BVAR (current_buffer, syntax_table) : Qt;
147 146
148 re_set_whitespace_regexp (NULL);
149
150 /* unblock_input (); */ 147 /* unblock_input (); */
151 if (val) 148 if (val)
152 xsignal1 (Qinvalid_regexp, build_string (val)); 149 xsignal1 (Qinvalid_regexp, build_string (val));