texinfo-commits
[Top][All Lists]
Advanced

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

[no subject]


From: Patrice Dumas
Date: Sat, 11 Nov 2023 18:18:38 -0500 (EST)

branch: master
commit f0561fb30974d1fc46fd1febbc9c5c6ee121402c
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sat Nov 11 18:02:35 2023 +0100

    * tp/Texinfo/XS/convert/convert_html.c (html_finalize_output_state),
    tp/Texinfo/XS/convert/converter.c (free_generic_converter),
    tp/Texinfo/XS/main/convert_utils.c (free_unclosed_files)
    (free_output_files_information, clear_output_files_information):
    clear/free output_files_information.
---
 ChangeLog                            |  8 ++++++++
 tp/TODO                              |  4 +++-
 tp/Texinfo/XS/convert/convert_html.c |  2 ++
 tp/Texinfo/XS/convert/converter.c    |  2 ++
 tp/Texinfo/XS/main/convert_utils.c   | 31 +++++++++++++++++++++++++++++++
 tp/Texinfo/XS/main/convert_utils.h   |  3 +++
 6 files changed, 49 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index d6f46d0781..70f9ac2b42 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -27,6 +27,14 @@
        Advice to use uc_width instead of c32width from Bruno Haible.
        c32width does not work for non-ASCII characters in the C locale.
 
+2023-11-11  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/XS/convert/convert_html.c (html_finalize_output_state),
+       tp/Texinfo/XS/convert/converter.c (free_generic_converter),
+       tp/Texinfo/XS/main/convert_utils.c (free_unclosed_files)
+       (free_output_files_information, clear_output_files_information):
+       clear/free output_files_information.
+
 2023-11-11  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/XS/convert/convert_html.c (html_destroy),
diff --git a/tp/TODO b/tp/TODO
index 08eed6e4af..c3c2412724 100644
--- a/tp/TODO
+++ b/tp/TODO
@@ -51,6 +51,8 @@ html_special_targets html_finalize_output_state
 index_entries html_finalize_output_state/destroy_merged_indices
 index_entries_by_letter (letter string, letter entries...) 
html_finalize_output_state/destroy_indices_sorted_by_letter
 title_titlepage html_finalize_output_state
+output_unit_files
+output_files_information html_finalize_output_state
 
 converter free
 special_units_direction_name html_finalize_output_state
@@ -73,7 +75,7 @@ no_arg_formatted_cmd_translated html_destroy
 reset_target_commands html_destroy
 file_changed_counter html_destroy
 output_unit_files
-output_files_information
+output_files_information free_generic_converter
 
 error_messages: with a check that it is empty?
 
diff --git a/tp/Texinfo/XS/convert/convert_html.c 
b/tp/Texinfo/XS/convert/convert_html.c
index 8fa402299c..f57d3a9b07 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -2565,6 +2565,8 @@ html_finalize_output_state (CONVERTER *self)
       self->index_entries_by_letter = 0;
     }
 
+  clear_output_files_information (&self->output_files_information);
+
   html_pop_document_context (self);
 
   /* could change to 0 in releases? */
diff --git a/tp/Texinfo/XS/convert/converter.c 
b/tp/Texinfo/XS/convert/converter.c
index d240380ea3..59dceac6d3 100644
--- a/tp/Texinfo/XS/convert/converter.c
+++ b/tp/Texinfo/XS/convert/converter.c
@@ -527,4 +527,6 @@ free_generic_converter (CONVERTER *self)
   if (self->conf)
     free_options (self->conf);
   free (self->conf);
+
+  free_output_files_information (&self->output_files_information);
 }
diff --git a/tp/Texinfo/XS/main/convert_utils.c 
b/tp/Texinfo/XS/main/convert_utils.c
index 1947b2b1f0..7a3106882c 100644
--- a/tp/Texinfo/XS/main/convert_utils.c
+++ b/tp/Texinfo/XS/main/convert_utils.c
@@ -628,6 +628,37 @@ register_unclosed_file (OUTPUT_FILES_INFORMATION *self, 
const char *file_path,
   return;
 }
 
+static void
+free_unclosed_files (FILE_STREAM_LIST *unclosed_files)
+{
+  if (unclosed_files->number)
+    {
+      size_t i;
+      for (i = 0; i < unclosed_files->number; i++)
+        {
+          free (unclosed_files->list[i].file_path);
+        }
+    }
+}
+
+/* not zeroed, left to the caller, if needed */
+void
+free_output_files_information (OUTPUT_FILES_INFORMATION *self)
+{
+  free_unclosed_files (&self->unclosed_files);
+  free (self->unclosed_files.list);
+
+  free_strings_list (&self->opened_files);
+}
+
+void
+clear_output_files_information (OUTPUT_FILES_INFORMATION *self)
+{
+  free_unclosed_files (&self->unclosed_files);
+  self->unclosed_files.number = 0;
+
+  clear_strings_list (&self->opened_files);
+}
 
 /*
  FILE_PATH is the file path, it should be a binary string.
diff --git a/tp/Texinfo/XS/main/convert_utils.h 
b/tp/Texinfo/XS/main/convert_utils.h
index 206011dc00..50c4832d67 100644
--- a/tp/Texinfo/XS/main/convert_utils.h
+++ b/tp/Texinfo/XS/main/convert_utils.h
@@ -52,4 +52,7 @@ FILE *output_files_open_out (OUTPUT_FILES_INFORMATION *self,
                              char **error_message, int binary);
 void output_files_register_closed (OUTPUT_FILES_INFORMATION *self,
                                    const char *file_path);
+void free_output_files_information (OUTPUT_FILES_INFORMATION *self);
+void clear_output_files_information (OUTPUT_FILES_INFORMATION *self);
+
 #endif



reply via email to

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