]> code.delx.au - gnu-emacs/blobdiff - src/search.c
(Vdefault_properties): New vbl.
[gnu-emacs] / src / search.c
index 7a406f8f0040640035f42f84e81196f9af532951..d3ac9140e05e7686170ef1fd78d3f386593ac6ff 100644 (file)
@@ -130,13 +130,6 @@ compile_pattern_1 (cp, pattern, translate, regp, posix)
     Fsignal (Qinvalid_regexp, Fcons (build_string (val), Qnil));
 
   cp->regexp = Fcopy_sequence (pattern);
-
-  /* Advise the searching functions about the space we have allocated
-     for register data.  */
-  BLOCK_INPUT;
-  if (regp)
-    re_set_registers (&cp->buf, regp, regp->num_regs, regp->start, regp->end);
-  UNBLOCK_INPUT;
 }
 
 /* Compile a regexp if necessary, but first check to see if there's one in
@@ -182,6 +175,11 @@ compile_pattern (pattern, regp, translate, posix)
   cp->next = searchbuf_head;
   searchbuf_head = cp;
 
+  /* Advise the searching functions about the space we have allocated
+     for register data.  */
+  if (regp)
+    re_set_registers (&cp->buf, regp, regp->num_regs, regp->start, regp->end);
+
   return &cp->buf;
 }
 
@@ -1311,10 +1309,8 @@ set_search_regs (beg, len)
      the match position.  */
   if (search_regs.num_regs == 0)
     {
-      regoff_t *starts, *ends;
-
-      starts = (regoff_t *) xmalloc (2 * sizeof (regoff_t));
-      ends = (regoff_t *) xmalloc (2 * sizeof (regoff_t));
+      search_regs.start = (regoff_t *) xmalloc (2 * sizeof (regoff_t));
+      search_regs.end = (regoff_t *) xmalloc (2 * sizeof (regoff_t));
       search_regs.num_regs = 2;
     }
 
@@ -1929,7 +1925,7 @@ LIST should have been created by calling `match-data' previously.")
 
 /* If non-zero the match data have been saved in saved_search_regs
    during the execution of a sentinel or filter. */
-static int search_regs_saved = 0;
+static int search_regs_saved;
 static struct re_registers saved_search_regs;
 
 /* Called from Flooking_at, Fstring_match, search_buffer, Fstore_match_data
@@ -1943,6 +1939,8 @@ save_search_regs ()
       saved_search_regs.start = search_regs.start;
       saved_search_regs.end = search_regs.end;
       search_regs.num_regs = 0;
+      search_regs.start = 0;
+      search_regs.end = 0;
 
       search_regs_saved = 1;
     }