diff src/search.c @ 93758:abcbb8375c30

(compile_pattern_1): Treat non-nil and non-string of search-spaces-regexp as nil.
author Chong Yidong <cyd@stupidchicken.com>
date Sat, 05 Apr 2008 21:40:16 +0000
parents 5a41bb37f0ee
children 8971ddf55736
line wrap: on
line diff
--- a/src/search.c	Sat Apr 05 21:40:04 2008 +0000
+++ b/src/search.c	Sat Apr 05 21:40:16 2008 +0000
@@ -141,7 +141,11 @@
   cp->posix = posix;
   cp->buf.multibyte = STRING_MULTIBYTE (pattern);
   cp->buf.charset_unibyte = charset_unibyte;
-  cp->whitespace_regexp = Vsearch_spaces_regexp;
+  if (STRINGP (Vsearch_spaces_regexp))
+    cp->whitespace_regexp = Vsearch_spaces_regexp;
+  else
+    cp->whitespace_regexp = Qnil;
+
   /* rms: I think BLOCK_INPUT is not needed here any more,
      because regex.c defines malloc to call xmalloc.
      Using BLOCK_INPUT here means the debugger won't run if an error occurs.
@@ -149,8 +153,11 @@
   /*  BLOCK_INPUT;  */
   old = re_set_syntax (RE_SYNTAX_EMACS
 		       | (posix ? 0 : RE_NO_POSIX_BACKTRACKING));
-  re_set_whitespace_regexp (NILP (Vsearch_spaces_regexp) ? NULL
-			    : SDATA (Vsearch_spaces_regexp));
+
+  if (STRINGP (Vsearch_spaces_regexp))
+    re_set_whitespace_regexp (SDATA (Vsearch_spaces_regexp));
+  else
+    re_set_whitespace_regexp (NULL);
 
   val = (char *) re_compile_pattern ((char *) SDATA (pattern),
 				     SBYTES (pattern), &cp->buf);