]> git.eshelyaron.com Git - emacs.git/commitdiff
No need for m_search_regs_saved in thread.h
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 28 Mar 2019 04:01:04 +0000 (21:01 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 28 Mar 2019 04:24:26 +0000 (21:24 -0700)
* src/search.c (save_search_regs, restore_search_regs):
Don’t use m_search_regs_saved; it’s equivalent to
saved_search_regs.num_regs != 0.
* src/thread.h (struct thread_state): Remove m_search_regs_saved.

src/search.c
src/thread.h

index e55aa767f1188357a1017137489556083b089ba1..e15e2b94e5f97c28e77414571a70581b512ef055 100644 (file)
@@ -3059,18 +3059,14 @@ If optional arg RESEAT is non-nil, make markers on LIST point nowhere.  */)
 static void
 save_search_regs (void)
 {
-  if (!search_regs_saved)
+  if (saved_search_regs.num_regs == 0)
     {
-      saved_search_regs.num_regs = search_regs.num_regs;
-      saved_search_regs.start = search_regs.start;
-      saved_search_regs.end = search_regs.end;
+      saved_search_regs = search_regs;
       saved_last_thing_searched = last_thing_searched;
       last_thing_searched = Qnil;
       search_regs.num_regs = 0;
       search_regs.start = 0;
       search_regs.end = 0;
-
-      search_regs_saved = 1;
     }
 }
 
@@ -3078,19 +3074,17 @@ save_search_regs (void)
 void
 restore_search_regs (void)
 {
-  if (search_regs_saved)
+  if (saved_search_regs.num_regs != 0)
     {
       if (search_regs.num_regs > 0)
        {
          xfree (search_regs.start);
          xfree (search_regs.end);
        }
-      search_regs.num_regs = saved_search_regs.num_regs;
-      search_regs.start = saved_search_regs.start;
-      search_regs.end = saved_search_regs.end;
+      search_regs = saved_search_regs;
       last_thing_searched = saved_last_thing_searched;
       saved_last_thing_searched = Qnil;
-      search_regs_saved = 0;
+      saved_search_regs.num_regs = 0;
     }
 }
 
index 1856fddf4cd98ec393523b4e7ac027d087138e59..50f8f5cbe0aa59a44cae976f3eb8ff7fad1cde25 100644 (file)
@@ -131,11 +131,6 @@ struct thread_state
   struct re_registers m_search_regs;
 #define search_regs (current_thread->m_search_regs)
 
-  /* If non-zero the match data have been saved in saved_search_regs
-     during the execution of a sentinel or filter. */
-  bool m_search_regs_saved;
-#define search_regs_saved (current_thread->m_search_regs_saved)
-
   struct re_registers m_saved_search_regs;
 #define saved_search_regs (current_thread->m_saved_search_regs)