texinfo-commits
[Top][All Lists]
Advanced

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

[5586] select_visited_node


From: Gavin D. Smith
Subject: [5586] select_visited_node
Date: Mon, 19 May 2014 21:24:12 +0000

Revision: 5586
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=5586
Author:   gavin
Date:     2014-05-19 21:24:11 +0000 (Mon, 19 May 2014)
Log Message:
-----------
select_visited_node

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/info/nodemenu.c
    trunk/info/window.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2014-05-19 17:04:05 UTC (rev 5585)
+++ trunk/ChangeLog     2014-05-19 21:24:11 UTC (rev 5586)
@@ -1,5 +1,15 @@
 2014-05-19  Gavin Smith  <address@hidden>
 
+       * info/nodemenu.c (get_visited_nodes): Don't reuse a local
+       variable for an unrelated purpose.  Declared static.  Argument
+       not set to anything other than null in calling code removed.  All
+       callers updated.
+       * (select_visited_node): Don't free objects too early and always
+       free them before function exit.
+       * info/window.c (message_buffer_to_node): Comment changed.
+
+2014-05-19  Gavin Smith  <address@hidden>
+
        * doc/info-stnd.texi (Invoking Info): Mention differences in groff
        terminal output.
 

Modified: trunk/info/nodemenu.c
===================================================================
--- trunk/info/nodemenu.c       2014-05-19 17:04:05 UTC (rev 5585)
+++ trunk/info/nodemenu.c       2014-05-19 21:24:11 UTC (rev 5586)
@@ -27,7 +27,7 @@
    format, and key bindings will be incorrectly assigned until infokey
    is rerun. */
 
-NODE *get_visited_nodes (Function *filter_func);
+static NODE *get_visited_nodes (void);
 
 /* Return a line describing the format of a node information line. */
 static const char *
@@ -127,11 +127,9 @@
 static char *nodemenu_nodename = "*Node Menu*";
 
 /* Produce an informative listing of all the visited nodes, and return it
-   in a node.  If FILTER_FUNC is non-null, it is a function which filters
-   which nodes will appear in the listing.  FILTER_FUNC takes an argument
-   of NODE, and returns non-zero if the node should appear in the listing. */
-NODE *
-get_visited_nodes (Function *filter_func)
+   in a newly allocated node. */
+static NODE *
+get_visited_nodes (void)
 {
   register int i, iw_index;
   INFO_WINDOW *info_win;
@@ -146,18 +144,18 @@
     {
       for (i = 0; i < info_win->nodes_index; i++)
         {
-          node = info_win->nodes[i];
+          NODE *history_node = info_win->nodes[i];
 
           /* We skip mentioning "*Node Menu*" nodes. */
-          if (internal_info_node_p (node) &&
+          if (internal_info_node_p (history_node) &&
               (strcmp (node->nodename, nodemenu_nodename) == 0))
             continue;
 
-          if (node && (!filter_func || (*filter_func) (node)))
+          if (history_node)
             {
               char *line;
 
-              line = format_node_info (node);
+              line = format_node_info (history_node);
               add_pointer_to_array (line, lines_index, lines, lines_slots, 20);
             }
         }
@@ -271,7 +269,7 @@
 
   /* Lines do not wrap in this window. */
   new->flags |= W_NoWrap;
-  node = get_visited_nodes (NULL);
+  node = get_visited_nodes ();
   name_internal_node (node, nodemenu_nodename);
 
 #if 0
@@ -311,24 +309,18 @@
   char *line;
   NODE *node;
 
-  node = get_visited_nodes (NULL);
-  free (node);
+  node = get_visited_nodes ();
 
-  line =
-    info_read_completing_in_echo_area (window,
+  line = info_read_completing_in_echo_area (window,
         _("Select visited node: "), node->references);
 
   window = active_window;
 
-  /* User aborts, just quit. */
   if (!line)
+    /* User aborts, just quit. */
+    info_abort_key (window, 0, 0);
+  else if (*line)
     {
-      info_abort_key (window, 0, 0);
-      return;
-    }
-
-  if (*line)
-    {
       REFERENCE *entry;
 
       /* Find the selected label in the references. */
@@ -341,6 +333,7 @@
     }
 
   free (line);
+  free (node);
 
   if (!info_error_was_printed)
     window_clear_echo_area ();

Modified: trunk/info/window.c
===================================================================
--- trunk/info/window.c 2014-05-19 17:04:05 UTC (rev 5585)
+++ trunk/info/window.c 2014-05-19 21:24:11 UTC (rev 5586)
@@ -1304,7 +1304,7 @@
   return node;
 }
 
-/* Convert the contents of the message buffer to a node. */
+/* Convert the contents of the message buffer to a newly allocated node. */
 NODE *
 message_buffer_to_node (void)
 {




reply via email to

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