texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Texinfo/XS/parsetexi/end_line.c (check_regis


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/XS/parsetexi/end_line.c (check_register_target_element_label), tp/Texinfo/XS/parsetexi/tree.c (destroy_node_spec): add destroy_node_spec to deallocate out of tree elements coollected in a label manual and node name specification, as well as the manual and node name associated elements. Use it in check_register_target_element_label. In the other cases, the manual and node name elements are used in the tree and will be deallocated when the tree is destroyed.
Date: Tue, 28 Feb 2023 09:04:20 -0500

This is an automated email from the git hooks/post-receive script.

pertusus pushed a commit to branch master
in repository texinfo.

The following commit(s) were added to refs/heads/master by this push:
     new eef9387508 * tp/Texinfo/XS/parsetexi/end_line.c 
(check_register_target_element_label), tp/Texinfo/XS/parsetexi/tree.c 
(destroy_node_spec): add destroy_node_spec to deallocate out of tree elements 
coollected in a label manual and node name specification, as well as the manual 
and node name associated elements.  Use it in 
check_register_target_element_label.  In the other cases, the manual and node 
name elements are used in the tree and will be deallocated when the tree is 
destroyed.
eef9387508 is described below

commit eef9387508b065ed489baf1a9d6fcaea16c0962f
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Tue Feb 28 15:04:16 2023 +0100

    * tp/Texinfo/XS/parsetexi/end_line.c
    (check_register_target_element_label), tp/Texinfo/XS/parsetexi/tree.c
    (destroy_node_spec): add destroy_node_spec to deallocate out of
    tree elements coollected in a label manual and node name
    specification, as well as the manual and node name associated
    elements.  Use it in check_register_target_element_label.  In the
    other cases, the manual and node name elements are used in the tree
    and will be deallocated when the tree is destroyed.
---
 ChangeLog                          | 11 +++++++++++
 tp/TODO                            |  4 ----
 tp/Texinfo/XS/parsetexi/end_line.c |  6 +-----
 tp/Texinfo/XS/parsetexi/tree.c     | 21 +++++++++++++++++++++
 tp/Texinfo/XS/parsetexi/tree.h     |  1 +
 5 files changed, 34 insertions(+), 9 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 0e5a05f22d..6f29f78e84 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2023-02-28  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/XS/parsetexi/end_line.c
+       (check_register_target_element_label), tp/Texinfo/XS/parsetexi/tree.c
+       (destroy_node_spec): add destroy_node_spec to deallocate out of
+       tree elements coollected in a label manual and node name
+       specification, as well as the manual and node name associated
+       elements.  Use it in check_register_target_element_label.  In the
+       other cases, the manual and node name elements are used in the tree
+       and will be deallocated when the tree is destroyed.
+
 2023-02-28  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/ParserNonXS.pm (_end_line_misc_line)
diff --git a/tp/TODO b/tp/TODO
index 6f2fc162f1..2cff7f8efd 100644
--- a/tp/TODO
+++ b/tp/TODO
@@ -13,10 +13,6 @@ Before next release
 Bugs
 ====
 
-Add a function to deallocate NODE_SPEC_EXTRA when parse_node_manual
-was called with modify_node = 0, to deallocate manual, content and
-out_of_tree_element(s)
-
 HTML API
 ========
 
diff --git a/tp/Texinfo/XS/parsetexi/end_line.c 
b/tp/Texinfo/XS/parsetexi/end_line.c
index dd4ca45163..0250bc9622 100644
--- a/tp/Texinfo/XS/parsetexi/end_line.c
+++ b/tp/Texinfo/XS/parsetexi/end_line.c
@@ -816,11 +816,7 @@ check_register_target_element_label (ELEMENT 
*label_element,
           free (texi);
           destroy_element (label_element_contents);
         }
-      if (label_info->manual_content)
-        destroy_element (label_info->manual_content);
-      if (label_info->node_content)
-        destroy_element (label_info->node_content);
-      free (label_info);
+      destroy_node_spec (label_info);
     }
   register_label (target_element);
 }
diff --git a/tp/Texinfo/XS/parsetexi/tree.c b/tp/Texinfo/XS/parsetexi/tree.c
index faa5aa03ec..64ffafd36d 100644
--- a/tp/Texinfo/XS/parsetexi/tree.c
+++ b/tp/Texinfo/XS/parsetexi/tree.c
@@ -393,3 +393,24 @@ args_child_by_index (ELEMENT *e, int index)
 
   return e->args.list[index];
 }
+
+/* should only be used if the nse->manual_content
+   and nse->node_content are not already in the tree,
+   in practice when the node spec was created by
+   parse_node_manual (., 0); */
+void
+destroy_node_spec (NODE_SPEC_EXTRA *nse)
+{
+  if (nse->out_of_tree_elements)
+    {
+      int i;
+      for (i = 0; i < 3; i++)
+        if (nse->out_of_tree_elements[i])
+          destroy_element (nse->out_of_tree_elements[i]);
+    }
+  if (nse->manual_content)
+    destroy_element (nse->manual_content);
+  if (nse->node_content)
+    destroy_element (nse->node_content);
+  free (nse);
+}
diff --git a/tp/Texinfo/XS/parsetexi/tree.h b/tp/Texinfo/XS/parsetexi/tree.h
index 1e58ec933b..7c646a8ce8 100644
--- a/tp/Texinfo/XS/parsetexi/tree.h
+++ b/tp/Texinfo/XS/parsetexi/tree.h
@@ -23,6 +23,7 @@ ELEMENT *contents_child_by_index (ELEMENT *e, int index);
 ELEMENT *args_child_by_index (ELEMENT *e, int index);
 void destroy_element (ELEMENT *e);
 void destroy_element_and_children (ELEMENT *e);
+void destroy_node_spec (NODE_SPEC_EXTRA *nse);
 
 #define element_contents_number(e) ((e)->contents.number)
 #define element_args_number(e) ((e)->args.number)



reply via email to

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