texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Texinfo/XS/convert/convert_html.c (html_dest


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/XS/convert/convert_html.c (html_destroy), tp/Texinfo/XS/convert/convert_html.c (reset_unset_no_arg_commands_formatting_context): free html_command_conversion strings and trees for no args commands, free no_arg_formatted_cmd, free translated_to_convert when replacing it in reset_unset_no_arg_commands_formatting_context.
Date: Sat, 11 Nov 2023 11:31:24 -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 169ce5ee49 * tp/Texinfo/XS/convert/convert_html.c (html_destroy), 
tp/Texinfo/XS/convert/convert_html.c 
(reset_unset_no_arg_commands_formatting_context): free html_command_conversion 
strings and trees for no args commands, free no_arg_formatted_cmd, free 
translated_to_convert when replacing it in 
reset_unset_no_arg_commands_formatting_context.
169ce5ee49 is described below

commit 169ce5ee49ed0bce17d428a04cf0540f4f86690d
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sat Nov 11 17:31:14 2023 +0100

    * tp/Texinfo/XS/convert/convert_html.c (html_destroy),
    tp/Texinfo/XS/convert/convert_html.c
    (reset_unset_no_arg_commands_formatting_context): free
    html_command_conversion strings and trees for no args commands, free
    no_arg_formatted_cmd, free translated_to_convert when replacing it in
    reset_unset_no_arg_commands_formatting_context.
    
    * tp/Texinfo/XS/convert/get_html_perl_info.c
    (html_converter_initialize_sv): comment out allocating memory for
    style converting, as it is not used/tested/freed for now.
---
 ChangeLog                                  | 13 +++++++++++++
 tp/TODO                                    |  6 ++++--
 tp/Texinfo/XS/convert/convert_html.c       | 24 +++++++++++++++++++++---
 tp/Texinfo/XS/convert/get_html_perl_info.c |  2 ++
 4 files changed, 40 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index a3140fb241..f333765afc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2023-11-11  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/XS/convert/convert_html.c (html_destroy),
+       tp/Texinfo/XS/convert/convert_html.c
+       (reset_unset_no_arg_commands_formatting_context): free
+       html_command_conversion strings and trees for no args commands, free
+       no_arg_formatted_cmd, free translated_to_convert when replacing it in
+       reset_unset_no_arg_commands_formatting_context.
+
+       * tp/Texinfo/XS/convert/get_html_perl_info.c
+       (html_converter_initialize_sv): comment out allocating memory for
+       style converting, as it is not used/tested/freed for now.
+
 2023-11-11  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/XS/convert/ConvertXS.xs
diff --git a/tp/TODO b/tp/TODO
index 003d75bb08..08eed6e4af 100644
--- a/tp/TODO
+++ b/tp/TODO
@@ -65,13 +65,15 @@ translated_commands translated_command->translation:strdup 
free_generic_converte
 expanded_formats free_generic_converter
 conf free_generic_converter
 init_conf free_generic_converter
-no_arg_formatted_cmd
+no_arg_formatted_cmd html_destroy
 pre_class_types html_destroy
 special_unit_varieties html_destroy
-html_command_conversion
+html_command_conversion html_destroy
 no_arg_formatted_cmd_translated html_destroy
 reset_target_commands html_destroy
 file_changed_counter html_destroy
+output_unit_files
+output_files_information
 
 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 d3c04ee545..8fa402299c 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -2635,6 +2635,25 @@ html_destroy (CONVERTER *self)
       free (self->pre_class_types[i]);
     }
 
+  for (i = 0; i < self->no_arg_formatted_cmd.number; i++)
+    {
+      enum command_id cmd = self->no_arg_formatted_cmd.list[i];
+      enum conversion_context cctx;
+      for (cctx = 0; cctx < HCC_type_css_string+1; cctx++)
+        {
+          HTML_COMMAND_CONVERSION *format_spec
+                = &self->html_command_conversion[cmd][cctx];
+          if (cctx == HCC_type_normal && format_spec->tree)
+            destroy_element_and_children (format_spec->tree);
+          free (format_spec->element);
+          free (format_spec->text);
+          free (format_spec->translated_converted);
+          free (format_spec->translated_to_convert);
+        }
+    }
+
+  free (self->no_arg_formatted_cmd.list);
+
   free (self->no_arg_formatted_cmd_translated.list);
   free (self->reset_target_commands.list);
   free (self->file_changed_counter.list);
@@ -2759,8 +2778,6 @@ reset_unset_no_arg_commands_formatting_context (CONVERTER 
*self,
           HTML_COMMAND_CONVERSION *no_arg_ref
             = &conversion_contexts[ref_context];
 
-          /* TODO memory leaks possible for the other char * fields */
-
           if (no_arg_ref->text)
             {
               free (no_arg_command_context->text);
@@ -2776,8 +2793,9 @@ reset_unset_no_arg_commands_formatting_context (CONVERTER 
*self,
             }
           if (no_arg_ref->translated_to_convert)
             {
+              free (no_arg_command_context->translated_to_convert);
               no_arg_command_context->translated_to_convert
-                = no_arg_ref->translated_to_convert;
+                = strdup (no_arg_ref->translated_to_convert);
             }
         }
     }
diff --git a/tp/Texinfo/XS/convert/get_html_perl_info.c 
b/tp/Texinfo/XS/convert/get_html_perl_info.c
index d5b37443f6..b4570b6d5e 100644
--- a/tp/Texinfo/XS/convert/get_html_perl_info.c
+++ b/tp/Texinfo/XS/convert/get_html_perl_info.c
@@ -706,9 +706,11 @@ html_converter_initialize_sv (SV *converter_sv,
                                                            &key, &retlen);
                               if (!strcmp (key, "element"))
                                 {
+                                   /* TODO add when it is used, and free
                                   char *tmp_spec
                                     = (char *) SvPVutf8_nolen (spec_sv);
                                   format_spec->element = strdup (tmp_spec);
+                                    */
                                 }
                               else if (!strcmp (key, "quote"))
                                 format_spec->quote = SvIV (spec_sv);



reply via email to

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