texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[7699] avoid calling extend_matches


From: gavinsmith0123
Subject: [7699] avoid calling extend_matches
Date: Tue, 21 Mar 2017 17:06:18 -0400 (EDT)

Revision: 7699
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=7699
Author:   gavin
Date:     2017-03-21 17:06:18 -0400 (Tue, 21 Mar 2017)
Log Message:
-----------
avoid calling extend_matches

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/info/search.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2017-03-21 20:09:44 UTC (rev 7698)
+++ trunk/ChangeLog     2017-03-21 21:06:18 UTC (rev 7699)
@@ -1,5 +1,10 @@
 2017-03-21  Gavin Smith  <address@hidden>
 
+       * info/search.c (at_end_of_matches): Avoid calling 
+       'extend_matches' if not necessary.
+
+2017-03-21  Gavin Smith  <address@hidden>
+
        Implement lazy search match lists.
 
        * info/window.h (MATCH_STATE): Add 'regex' field of type regex_t.

Modified: trunk/info/search.c
===================================================================
--- trunk/info/search.c 2017-03-21 20:09:44 UTC (rev 7698)
+++ trunk/info/search.c 2017-03-21 21:06:18 UTC (rev 7699)
@@ -547,16 +547,22 @@
   *in_match = m;
 }
 
+/* Used for iterating through a match list. */
 int
 at_end_of_matches (MATCH_STATE *state, int index)
 {
-  if (!state->finished)
-    extend_matches (state);
+  if (index < state->match_count)
+    return 0;
+  else
+    {
+      if (!state->finished)
+        extend_matches (state);
 
-  if (state->finished)
-    return (state->match_count == index) ? 1 : 0;
-  else
-    return 0;
+      if (state->finished)
+        return (state->match_count == index) ? 1 : 0;
+      else
+        return 0;
+    }
 }
 
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]