texinfo-commits
[Top][All Lists]
Advanced

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

[8264] parsetexi free node content


From: gavinsmith0123
Subject: [8264] parsetexi free node content
Date: Sat, 6 Oct 2018 12:29:16 -0400 (EDT)

Revision: 8264
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=8264
Author:   gavin
Date:     2018-10-06 12:29:15 -0400 (Sat, 06 Oct 2018)
Log Message:
-----------
parsetexi free node content

Modified Paths:
--------------
    trunk/tp/Texinfo/XS/parsetexi/end_line.c
    trunk/tp/Texinfo/XS/parsetexi/separator.c
    trunk/tp/Texinfo/XS/parsetexi/tree.c
    trunk/tp/Texinfo/XS/parsetexi/tree.h

Modified: trunk/tp/Texinfo/XS/parsetexi/end_line.c
===================================================================
--- trunk/tp/Texinfo/XS/parsetexi/end_line.c    2018-10-06 15:44:44 UTC (rev 
8263)
+++ trunk/tp/Texinfo/XS/parsetexi/end_line.c    2018-10-06 16:29:15 UTC (rev 
8264)
@@ -1160,7 +1160,8 @@
           check_internal_node (float_label);
 
           register_label (current, float_label->node_content);
-          free_node_contents (float_label->manual_content);
+          if (float_label->manual_content)
+            destroy_element (float_label->manual_content);
           free (float_label);
         }
       parse_float_type (current);

Modified: trunk/tp/Texinfo/XS/parsetexi/separator.c
===================================================================
--- trunk/tp/Texinfo/XS/parsetexi/separator.c   2018-10-06 15:44:44 UTC (rev 
8263)
+++ trunk/tp/Texinfo/XS/parsetexi/separator.c   2018-10-06 16:29:15 UTC (rev 
8264)
@@ -305,7 +305,8 @@
               register_label (current->parent, parsed_anchor->node_content);
               if (current_region ())
                 add_extra_element (current, "region", current_region ());
-              free_node_contents (parsed_anchor->manual_content);
+              if (parsed_anchor->manual_content)
+                destroy_element (parsed_anchor->manual_content);
             }
           free (parsed_anchor);
         }
@@ -339,8 +340,10 @@
                     add_extra_node_spec (ref, "node_argument", nse);
                   else
                     {
-                      free_node_contents (nse->manual_content);
-                      free_node_contents (nse->node_content);
+                      if (nse->manual_content)
+                        destroy_element (nse->manual_content);
+                      if (nse->node_content)
+                        destroy_element (nse->node_content);
                       free (nse);
                     }
                   if (closed_command != CM_inforef

Modified: trunk/tp/Texinfo/XS/parsetexi/tree.c
===================================================================
--- trunk/tp/Texinfo/XS/parsetexi/tree.c        2018-10-06 15:44:44 UTC (rev 
8263)
+++ trunk/tp/Texinfo/XS/parsetexi/tree.c        2018-10-06 16:29:15 UTC (rev 
8264)
@@ -1,4 +1,4 @@
-/* Copyright 2010, 2011, 2012, 2013, 2014, 2015
+/* Copyright 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018
    Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
@@ -47,22 +47,6 @@
 }
 
 void
-free_node_contents (ELEMENT *e)
-{
-  int i;
-  if (e)
-    {
-      for (i = 0; i < e->contents.number; i++)
-        {
-          if (e->contents.list[i]->parent_type
-              == route_not_in_tree)
-            destroy_element (e->contents.list[i]);
-        }
-      free (e);
-    }
-}
-
-void
 destroy_element (ELEMENT *e)
 {
   int i;
@@ -103,12 +87,15 @@
             {
               NODE_SPEC_EXTRA *nse = (NODE_SPEC_EXTRA *) e->extra[i].value;
 
-              //free_node_contents (nse->manual_content);
-              //free_node_contents (nse->node_content);
-              /* Problem - some of the elements in 'node_content' may have
-                 been in the main tree and have been free'd already.  If
-                 that is the case, we can't rely on checking whether the
-                 elements are 'route_not_in_tree'. */
+              if (nse->manual_content)
+                destroy_element (nse->manual_content);
+              if (nse->node_content)
+                destroy_element (nse->node_content);
+              /* Problem - some of the elements in 'node_content' may not
+                 have been in the main tree and need to be freed as well.
+                 We can't rely on checking whether the elements are 
+                 'route_not_in_tree' as the elements may have been freed 
+                 already. */
               free (nse);
               break;
             }

Modified: trunk/tp/Texinfo/XS/parsetexi/tree.h
===================================================================
--- trunk/tp/Texinfo/XS/parsetexi/tree.h        2018-10-06 15:44:44 UTC (rev 
8263)
+++ trunk/tp/Texinfo/XS/parsetexi/tree.h        2018-10-06 16:29:15 UTC (rev 
8264)
@@ -27,7 +27,6 @@
 ELEMENT *pop_element_from_contents (ELEMENT *parent);
 ELEMENT *contents_child_by_index (ELEMENT *e, int index);
 ELEMENT *args_child_by_index (ELEMENT *e, int index);
-void free_node_contents (ELEMENT *e);
 void destroy_element (ELEMENT *e);
 void destroy_element_and_children (ELEMENT *e);
 




reply via email to

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