summaryrefslogtreecommitdiff
path: root/src/search.c
diff options
context:
space:
mode:
authorMichal Nazarewicz <mina86@mina86.com>2016-07-27 22:53:57 +0200
committerMichal Nazarewicz <mina86@mina86.com>2016-08-02 15:39:10 +0200
commitda9c55ddbbd08fc07ab36dc8bdc740e352eeab2c (patch)
tree597b4d4f7e7a0d784e26b5f114a035b4c068e1f0 /src/search.c
parent04d96eca08ff797c0cd93c33fe8589f4623fc449 (diff)
downloademacs-da9c55ddbbd08fc07ab36dc8bdc740e352eeab2c.tar.gz
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
compile_pattern_1 (struct regexp_cache *cp, Lisp_Object pattern,
Lisp_Object translate, bool posix)
{
+ const char *whitespace_regexp;
reg_syntax_t syntax;
char *val;
@@ -132,21 +133,17 @@ compile_pattern_1 (struct regexp_cache *cp, Lisp_Object pattern,
So let's turn it off. */
/* BLOCK_INPUT; */
- if (STRINGP (Vsearch_spaces_regexp))
- re_set_whitespace_regexp (SSDATA (Vsearch_spaces_regexp));
- else
- re_set_whitespace_regexp (NULL);
-
syntax = RE_SYNTAX_EMACS | (posix ? 0 : RE_NO_POSIX_BACKTRACKING);
+ whitespace_regexp = STRINGP (Vsearch_spaces_regexp) ?
+ SSDATA (Vsearch_spaces_regexp) : NULL;
+
val = (char *) re_compile_pattern (SSDATA (pattern), SBYTES (pattern),
- syntax, &cp->buf);
+ syntax, whitespace_regexp, &cp->buf);
/* If the compiled pattern hard codes some of the contents of the
syntax-table, it can only be reused with *this* syntax table. */
cp->syntax_table = cp->buf.used_syntax ? BVAR (current_buffer, syntax_table) : Qt;
- re_set_whitespace_regexp (NULL);
-
/* unblock_input (); */
if (val)
xsignal1 (Qinvalid_regexp, build_string (val));