texinfo-commits
[Top][All Lists]
Advanced

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

[no subject]


From: Patrice Dumas
Date: Sun, 29 Sep 2024 06:05:58 -0400 (EDT)

branch: master
commit 3689274ef3ef151fd404e11a033dfa37d1f143dc
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Jun 16 12:13:38 2024 +0200

    * tp/Texinfo/XS/structuring_transfo/transformations.c
    (protect_first_parenthesis_in_targets_internal): check that the
    element is an @-command element before calling get_label_element.
---
 ChangeLog                                           | 6 ++++++
 tp/TODO                                             | 3 ---
 tp/Texinfo/XS/main/convert_to_texinfo.h             | 4 ++--
 tp/Texinfo/XS/main/manipulate_tree.c                | 4 ++++
 tp/Texinfo/XS/main/utils.c                          | 2 ++
 tp/Texinfo/XS/structuring_transfo/transformations.c | 6 +++++-
 6 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 14bb10a1e1..8b64ec6f58 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,12 @@
        * tp/Texinfo/XS/convert/convert_html.c (html_command_description):
        update for move of cmd to CONTAINER.
 
+2024-06-16  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/XS/structuring_transfo/transformations.c
+       (protect_first_parenthesis_in_targets_internal): check that the
+       element is an @-command element before calling get_label_element.
+
 2024-06-16  Patrice Dumas  <pertusus@free.fr>
 
        Turn source_mark_list to a pointer
diff --git a/tp/TODO b/tp/TODO
index f64cf33043..1a4a26fbbe 100644
--- a/tp/TODO
+++ b/tp/TODO
@@ -13,9 +13,6 @@ Before next release
 Bugs
 ====
 
-valgrind perl -w t/transformations.t 
protect_first_parenthesis_after_parenthesis_source_mark
-
-
 HTML API
 ========
 
diff --git a/tp/Texinfo/XS/main/convert_to_texinfo.h 
b/tp/Texinfo/XS/main/convert_to_texinfo.h
index f33ff7190f..e6f8e53eeb 100644
--- a/tp/Texinfo/XS/main/convert_to_texinfo.h
+++ b/tp/Texinfo/XS/main/convert_to_texinfo.h
@@ -9,8 +9,8 @@ char *convert_contents_to_texinfo (const ELEMENT *e);
 char *link_element_to_texi (const ELEMENT *element);
 char *target_element_to_texi_label (const ELEMENT *element);
 
-int check_node_same_texinfo_code(const ELEMENT *reference_node,
-                                 const ELEMENT *node_content);
+int check_node_same_texinfo_code (const ELEMENT *reference_node,
+                                  const ELEMENT *node_content);
 char *root_heading_command_to_texinfo (const ELEMENT *element);
 
 #endif
diff --git a/tp/Texinfo/XS/main/manipulate_tree.c 
b/tp/Texinfo/XS/main/manipulate_tree.c
index 0b84451bed..8adcf4183b 100644
--- a/tp/Texinfo/XS/main/manipulate_tree.c
+++ b/tp/Texinfo/XS/main/manipulate_tree.c
@@ -767,6 +767,10 @@ parse_node_manual (ELEMENT *node, int modify_node)
 
 
 
+/* the caller should make sure that the tree is not a text element */
+/* NOTE there is no recursion in modified elements.  If this becomes relevant,
+   OPERATION should be changed such that it becomes possible to signal that
+   a recursion is needed */
 ELEMENT *
 modify_tree (ELEMENT *tree,
              ELEMENT_LIST *(*operation)(const char *type, ELEMENT *element, 
void* argument),
diff --git a/tp/Texinfo/XS/main/utils.c b/tp/Texinfo/XS/main/utils.c
index 32f517ea36..247bc90443 100644
--- a/tp/Texinfo/XS/main/utils.c
+++ b/tp/Texinfo/XS/main/utils.c
@@ -650,6 +650,8 @@ item_line_parent (ELEMENT *current)
   return 0;
 }
 
+/* The caller should take care not to call get_label_element on a text
+   element */
 ELEMENT *
 get_label_element (const ELEMENT *e)
 {
diff --git a/tp/Texinfo/XS/structuring_transfo/transformations.c 
b/tp/Texinfo/XS/structuring_transfo/transformations.c
index c33c5d6d73..00f653a94f 100644
--- a/tp/Texinfo/XS/structuring_transfo/transformations.c
+++ b/tp/Texinfo/XS/structuring_transfo/transformations.c
@@ -1490,7 +1490,11 @@ protect_first_parenthesis_in_targets_internal (const 
char *type,
                                                ELEMENT *current,
                                                void *argument)
 {
-  ELEMENT *element_label = get_label_element (current);
+  ELEMENT *element_label;
+  if (!(type_data[current->type].flags & TF_at_command))
+    return 0;
+
+  element_label = get_label_element (current);
   if (element_label)
     protect_first_parenthesis (element_label);
   return 0;



reply via email to

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