[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/XS/convert/convert_html.c (html_get_
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/XS/convert/convert_html.c (html_get_css_elements_classes): free selctors. |
Date: |
Wed, 22 Nov 2023 04:20:53 -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 60475741b6 * tp/Texinfo/XS/convert/convert_html.c
(html_get_css_elements_classes): free selctors.
60475741b6 is described below
commit 60475741b67d84201aea12af4ab708943d467a58
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Wed Nov 22 10:20:43 2023 +0100
* tp/Texinfo/XS/convert/convert_html.c
(html_get_css_elements_classes): free selctors.
* tp/Texinfo/XS/convert/convert_html.c (html_finalize_output_state),
tp/Texinfo/XS/main/converter_types.h (CSS_LIST, CSS_SELECTOR_STYLE):
free self->page_name_number, self->page_css and
self->css_element_class_styles structures. Free self->pending_closes
stack.
---
ChangeLog | 11 +++++++++++
tp/Texinfo/XS/convert/convert_html.c | 32 +++++++++++++++++++++++++++++++-
tp/Texinfo/XS/main/converter_types.h | 8 ++++----
3 files changed, 46 insertions(+), 5 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 3fee5ba718..f9267e4088 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2023-11-22 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/XS/convert/convert_html.c
+ (html_get_css_elements_classes): free selctors.
+
+ * tp/Texinfo/XS/convert/convert_html.c (html_finalize_output_state),
+ tp/Texinfo/XS/main/converter_types.h (CSS_LIST, CSS_SELECTOR_STYLE):
+ free self->page_name_number, self->page_css and
+ self->css_element_class_styles structures. Free self->pending_closes
+ stack.
+
2023-11-21 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/Convert/HTML.pm (html_get_css_elements_classes)
diff --git a/tp/Texinfo/XS/convert/convert_html.c
b/tp/Texinfo/XS/convert/convert_html.c
index a7463f9253..c29318ac5b 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -1678,7 +1678,8 @@ find_css_selector_style
{
CSS_SELECTOR_STYLE *result = 0;
static CSS_SELECTOR_STYLE searched_selector;
- searched_selector.selector = selector;
+ /* remove const with a cast, it is more efficient than duplicating */
+ searched_selector.selector = (char *) selector;
result = (CSS_SELECTOR_STYLE *) bsearch (&searched_selector,
css_element_class_styles->list,
@@ -1820,6 +1821,8 @@ html_get_css_elements_classes (CONVERTER *self, const
char *filename)
for (j = 0; j < selector_nr; j++)
add_string (selectors[j], result);
+ free (selectors);
+
return result;
}
@@ -2847,6 +2850,8 @@ html_set_pages_files (CONVERTER *self, OUTPUT_UNIT_LIST
*output_units,
return files_source_info;
}
+/* setup a page (+global context) in case there are no files, ie called
+ with convert or output with an empty string as filename. */
void
setup_output_simple_page (CONVERTER *self, const char *output_filename)
{
@@ -3544,6 +3549,20 @@ html_finalize_output_state (CONVERTER *self)
clear_output_files_information (&self->output_files_information);
clear_output_unit_files (&self->output_unit_files);
+ free (self->page_name_number.list);
+ memset (&self->page_name_number, 0, sizeof (PAGE_NAME_NUMBER_LIST));
+
+ for (i = 0; i < self->page_css.number; i++)
+ {
+ int j;
+ CSS_LIST *page_css_list = &self->page_css.list[i];
+
+ for (j = 0; j < page_css_list->number; j++)
+ free (page_css_list->list[j]);
+ free (page_css_list->list);
+ }
+ free (self->page_css.list);
+
/* should not be possible with default code, as
close_registered_sections_level(0)
is called at the end of processing or at the end of each file.
@@ -3633,6 +3652,15 @@ html_free_converter (CONVERTER *self)
free (self->pre_class_types[i]);
}
+ for (i = 0; i < self->css_element_class_styles.number; i++)
+ {
+ CSS_SELECTOR_STYLE *selector_style
+ = &self->css_element_class_styles.list[i];
+ free (selector_style->selector);
+ free (selector_style->style);
+ }
+ free (self->css_element_class_styles.list);
+
for (i = 0; i < self->no_arg_formatted_cmd.number; i++)
{
enum command_id cmd = self->no_arg_formatted_cmd.list[i];
@@ -3662,6 +3690,8 @@ html_free_converter (CONVERTER *self)
free (self->no_arg_formatted_cmd.list);
+ free (self->pending_closes.stack);
+
free (self->no_arg_formatted_cmd_translated.list);
free (self->reset_target_commands.list);
free (self->file_changed_counter.list);
diff --git a/tp/Texinfo/XS/main/converter_types.h
b/tp/Texinfo/XS/main/converter_types.h
index 639af88641..c789414f90 100644
--- a/tp/Texinfo/XS/main/converter_types.h
+++ b/tp/Texinfo/XS/main/converter_types.h
@@ -272,10 +272,10 @@ typedef struct PAGE_NAME_NUMBER_LIST {
} PAGE_NAME_NUMBER_LIST;
typedef struct CSS_LIST {
- const char *page_name;
+ char *page_name;
size_t number;
size_t space;
- const char **list;
+ char **list;
} CSS_LIST;
typedef struct PAGES_CSS_LIST {
@@ -396,8 +396,8 @@ typedef struct HTML_ADDED_TARGET_LIST {
} HTML_ADDED_TARGET_LIST;
typedef struct CSS_SELECTOR_STYLE {
- const char *selector;
- const char *style;
+ char *selector;
+ char *style;
} CSS_SELECTOR_STYLE;
typedef struct CSS_SELECTOR_STYLE_LIST {
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/XS/convert/convert_html.c (html_get_css_elements_classes): free selctors.,
Patrice Dumas <=
- Prev by Date:
branch master updated: * tp/Texinfo/Convert/HTML.pm (html_get_css_elements_classes) (_default_format_css_lines), doc/texi2any_api.texi (Customizing CSS): have html_get_css_elements_classes return a reference on an array, not an array.
- Next by Date:
branch master updated: * tp/Texinfo/XS/Makefile.am, * tp/Texinfo/XS/configure.ac (PERL_INC, XSUBPPARGS): Define in configure.ac and propagate to Makefile.am, so it is more clear what "archlibexp" and "privlibexp" from the Perl conf are being used for.
- Previous by thread:
branch master updated: * tp/Texinfo/Convert/HTML.pm (html_get_css_elements_classes) (_default_format_css_lines), doc/texi2any_api.texi (Customizing CSS): have html_get_css_elements_classes return a reference on an array, not an array.
- Next by thread:
branch master updated: * tp/Texinfo/XS/Makefile.am, * tp/Texinfo/XS/configure.ac (PERL_INC, XSUBPPARGS): Define in configure.ac and propagate to Makefile.am, so it is more clear what "archlibexp" and "privlibexp" from the Perl conf are being used for.
- Index(es):