[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Patrice Dumas |
Date: |
Wed, 6 Dec 2023 15:25:39 -0500 (EST) |
branch: master
commit f2a192267e17e8bcf8a6481e0110e1931fa853ff
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Tue Dec 5 17:40:34 2023 +0100
* tp/Texinfo/XS/convert/convert_html.c (convert_heading_command):
destroy the menu that was automatically generated.
* tp/Texinfo/XS/convert/convert_html.c (convert_heading_command)
(convert_special_unit_type): free closed_strings list, classes,
heading.
* tp/Texinfo/XS/convert/convert_html.c (html_finalize_output_state)
(html_free_converter): reset and free added_targets.
* tp/Texinfo/XS/structuring_transfo/structuring.c (print_down_menus):
destroy the new menu created if there was none in the node.
* tp/Texinfo/XS/structuring_transfo/structuring.c
(new_complete_menu_master_menu): destroy temporary menus list.
---
ChangeLog | 18 +++++++++++++++++
tp/Texinfo/XS/convert/convert_html.c | 14 ++++++++++---
tp/Texinfo/XS/structuring_transfo/structuring.c | 26 ++++++++++++++++---------
tp/Texinfo/XS/structuring_transfo/structuring.h | 2 +-
4 files changed, 47 insertions(+), 13 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index b4eb5c1623..e110c21f00 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2023-12-05 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/XS/convert/convert_html.c (convert_heading_command):
+ destroy the menu that was automatically generated.
+
+ * tp/Texinfo/XS/convert/convert_html.c (convert_heading_command)
+ (convert_special_unit_type): free closed_strings list, classes,
+ heading.
+
+ * tp/Texinfo/XS/convert/convert_html.c (html_finalize_output_state)
+ (html_free_converter): reset and free added_targets.
+
+ * tp/Texinfo/XS/structuring_transfo/structuring.c (print_down_menus):
+ destroy the new menu created if there was none in the node.
+
+ * tp/Texinfo/XS/structuring_transfo/structuring.c
+ (new_complete_menu_master_menu): destroy temporary menus list.
+
2023-12-05 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/XS/convert/call_html_perl_function.c
diff --git a/tp/Texinfo/XS/convert/convert_html.c
b/tp/Texinfo/XS/convert/convert_html.c
index 98db9c9e9d..001934d309 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -5126,7 +5126,6 @@ convert_heading_command (CONVERTER *self, const enum
command_id cmd,
ELEMENT_LIST *menus = lookup_extra_contents (node, "menus", 0);
if (!menus && automatic_directions)
{
- /* FIXME setup a TREE_ADDED_ELEMENTS */
ELEMENT *menu_node
= new_complete_menu_master_menu (self->conf,
self->document->identifiers_target, node);
@@ -5138,6 +5137,8 @@ convert_heading_command (CONVERTER *self, const enum
command_id cmd,
&mini_toc_or_auto_menu, 0);
remove_element_from_list (&self->tree_to_build,
menu_node);
+ /* there are only new or copied elements in the menu */
+ destroy_element_and_children (menu_node);
}
}
}
@@ -5319,6 +5320,7 @@ convert_heading_command (CONVERTER *self, const enum
command_id cmd,
free (closed_strings->list[i]);
}
}
+ free (closed_strings->list);
free (closed_strings);
html_register_opened_section_level (self, level, "</div>\n");
@@ -5335,7 +5337,7 @@ convert_heading_command (CONVERTER *self, const enum
command_id cmd,
add_string (class, classes);
free (class);
attribute_class = html_attribute_class (self, "div", classes);
- clear_strings_list (classes);
+ destroy_strings_list (classes);
text_append (result, attribute_class);
free (attribute_class);
@@ -5666,7 +5668,7 @@ convert_special_unit_type (CONVERTER *self,
const OUTPUT_UNIT *output_unit, const char *content,
TEXT *result)
{
- const char *heading;
+ char *heading;
size_t number;
TEXT special_unit_body;
ELEMENT *unit_command;
@@ -5770,6 +5772,7 @@ convert_special_unit_type (CONVERTER *self,
formatted_heading
= call_formatting_function_format_heading_text (self, 0, classes, heading,
level, 0, 0, 0);
+ free (heading);
destroy_strings_list (classes);
text_append (result, formatted_heading);
text_append_n (result, "\n", 1);
@@ -6342,6 +6345,8 @@ html_finalize_output_state (CONVERTER *self)
reset_html_targets (self, &self->html_special_targets[i]);
}
+ self->added_targets.number = 0;
+
free (self->tree_to_build.list);
free (self->special_units_direction_name);
@@ -6488,6 +6493,9 @@ html_free_converter (CONVERTER *self)
{
free (self->html_special_targets[i].list);
}
+
+ free (self->added_targets.list);
+
for (i = 0; i < SUIT_type_heading+1; i++)
{/* we assume that reset_translated_special_unit_info_tree
has already been called */
diff --git a/tp/Texinfo/XS/structuring_transfo/structuring.c
b/tp/Texinfo/XS/structuring_transfo/structuring.c
index b407e114dc..4fa267ac6e 100644
--- a/tp/Texinfo/XS/structuring_transfo/structuring.c
+++ b/tp/Texinfo/XS/structuring_transfo/structuring.c
@@ -1803,24 +1803,27 @@ new_complete_node_menu (ELEMENT *node, int use_sections)
}
ELEMENT_LIST *
-print_down_menus(ELEMENT *node, LABEL_LIST *identifiers_target,
- int use_sections)
+print_down_menus (ELEMENT *node, LABEL_LIST *identifiers_target,
+ int use_sections)
{
ELEMENT_LIST *master_menu_contents = new_list ();
ELEMENT_LIST *menus;
ELEMENT_LIST *node_menus = lookup_extra_contents (node, "menus", 0);
ELEMENT_LIST *node_children;
+ ELEMENT *new_current_menu = 0;
int i;
if (node_menus && node_menus->number > 0)
menus = node_menus;
else
{
- ELEMENT *current_menu = new_complete_node_menu (node, use_sections);
- if (current_menu)
+ /* If there is no menu for the node, we create a temporary menu to be
+ able to find and copy entries as if there was already a menu */
+ new_current_menu = new_complete_node_menu (node, use_sections);
+ if (new_current_menu)
{
menus = new_list ();
- add_to_element_list (menus, current_menu);
+ add_to_element_list (menus, new_current_menu);
}
else
return master_menu_contents;
@@ -1849,6 +1852,12 @@ print_down_menus(ELEMENT *node, LABEL_LIST
*identifiers_target,
}
}
+ if (!node_menus)
+ destroy_list (menus);
+
+ if (new_current_menu)
+ destroy_element_and_children (new_current_menu);
+
if (master_menu_contents->number > 0)
{
ELEMENT *node_name_element;
@@ -1901,15 +1910,12 @@ print_down_menus(ELEMENT *node, LABEL_LIST
*identifiers_target,
destroy_list (node_children);
- if (!node_menus)
- destroy_list (menus);
-
return master_menu_contents;
}
ELEMENT *
new_master_menu (OPTIONS *options, LABEL_LIST *identifiers_target,
- ELEMENT_LIST *menus, int use_sections)
+ const ELEMENT_LIST *menus, int use_sections)
{
/* only holds contents here, will be turned into a proper block
in new_block_command */
@@ -2017,6 +2023,8 @@ new_complete_menu_master_menu (OPTIONS *options,
add_to_element_list (menus, menu_node);
detailmenu = new_master_menu (options, identifiers_target,
menus, 0);
+ destroy_list (menus);
+
if (detailmenu)
{
/* add a blank line before the detailed node listing */
diff --git a/tp/Texinfo/XS/structuring_transfo/structuring.h
b/tp/Texinfo/XS/structuring_transfo/structuring.h
index 7d2c84e194..febc3bf6e4 100644
--- a/tp/Texinfo/XS/structuring_transfo/structuring.h
+++ b/tp/Texinfo/XS/structuring_transfo/structuring.h
@@ -21,7 +21,7 @@ ELEMENT *new_node_menu_entry (ELEMENT *node, int
use_sections);
ELEMENT *new_complete_node_menu (ELEMENT *node, int use_sections);
void new_block_command (ELEMENT *element, enum command_id cmd);
ELEMENT *new_master_menu (OPTIONS *options, LABEL_LIST *identifiers_target,
- ELEMENT_LIST *menus, int use_sections);
+ const ELEMENT_LIST *menus, int use_sections);
ELEMENT *new_complete_menu_master_menu (OPTIONS *options,
LABEL_LIST *identifiers_target,
- master updated (649b0b3021 -> d6d18fe56e), Patrice Dumas, 2023/12/06
- [no subject], Patrice Dumas, 2023/12/06
- [no subject], Patrice Dumas, 2023/12/06
- [no subject], Patrice Dumas, 2023/12/06
- [no subject],
Patrice Dumas <=
- [no subject], Patrice Dumas, 2023/12/06
- [no subject], Patrice Dumas, 2023/12/06