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_defa


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/XS/convert/convert_html.c (html_default_format_navigation_panel): free result_buttons.
Date: Sun, 10 Dec 2023 05:55:14 -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 4f8323fe9d * tp/Texinfo/XS/convert/convert_html.c 
(html_default_format_navigation_panel): free result_buttons.
4f8323fe9d is described below

commit 4f8323fe9de659a00d75cb72c132527adc0fd791
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Dec 10 11:55:06 2023 +0100

    * tp/Texinfo/XS/convert/convert_html.c
    (html_default_format_navigation_panel): free result_buttons.
    
    * tp/Texinfo/XS/convert/get_html_perl_info.c
    (html_converter_prepare_output_sv): allocate jslicenses.list only if
    not empty.
    
    * tp/Texinfo/XS/convert/convert_html.c
    (html_default_format_program_string, format_program_string): implement
    format_program_string in C.
---
 ChangeLog                                  |  13 +++
 tp/Texinfo/XS/convert/convert_html.c       |  43 +++++++++-
 tp/Texinfo/XS/convert/get_html_perl_info.c | 124 +++++++++++++++--------------
 3 files changed, 117 insertions(+), 63 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 62b3cde6d9..be6cfe7d38 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2023-12-10  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/XS/convert/convert_html.c
+       (html_default_format_navigation_panel): free result_buttons.
+
+       * tp/Texinfo/XS/convert/get_html_perl_info.c
+       (html_converter_prepare_output_sv): allocate jslicenses.list only if
+       not empty.
+
+       * tp/Texinfo/XS/convert/convert_html.c
+       (html_default_format_program_string, format_program_string): implement
+       format_program_string in C.
+
 2023-12-10  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/options_data.txt (PROGRAM_NAME_IN_FOOTER): type is int.
diff --git a/tp/Texinfo/XS/convert/convert_html.c 
b/tp/Texinfo/XS/convert/convert_html.c
index bc0b4b0092..e5b716b5fc 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -5482,19 +5482,57 @@ format_element_footer (CONVERTER *self,
    }
 }
 
+void
+html_default_format_program_string (CONVERTER *self, TEXT *result)
+{
+  ELEMENT *tree;
+  if (self->conf->PROGRAM && strlen (self->conf->PROGRAM)
+      && self->conf->PACKAGE_URL_OPTION)
+    {
+      ELEMENT *program_homepage = new_element (ET_NONE);
+      ELEMENT *program = new_element (ET_NONE);
+      NAMED_STRING_ELEMENT_LIST *substrings
+                                   = new_named_string_element_list ();
+
+      text_append (&program_homepage->text, self->conf->PACKAGE_URL_OPTION);
+      text_append (&program->text, self->conf->PROGRAM);
+
+      add_element_to_named_string_element_list (substrings,
+                                    "program_homepage", program_homepage);
+      add_element_to_named_string_element_list (substrings,
+                                                "program", program);
+
+      tree = html_gdt_tree ("This document was generated on @emph{@today{}} "
+                            "using @uref{{program_homepage}, 
@emph{{program}}}.",
+                            self->document, self, substrings, 0, 0);
+      destroy_named_string_element_list (substrings);
+      /* destroyed with the tree
+      destroy_element (program);
+      destroy_element (program_homepage);
+       */
+    }
+  else
+    {
+      tree = html_gdt_tree ("This document was generated on @emph{@today{}}.",
+                            self->document, self, 0, 0, 0);
+    }
+  add_to_element_list (&self->tree_to_build, tree);
+  convert_to_html_internal (self, tree, result, 0);
+  remove_element_from_list (&self->tree_to_build, tree);
+  destroy_element_and_children (tree);
+}
+
 void
 format_program_string (CONVERTER *self, TEXT *result)
 {
   FORMATTING_REFERENCE *formatting_reference
    = &self->current_formatting_references[FR_format_program_string];
 
-/*
   if (formatting_reference->status == FRS_status_default_set)
     {
       html_default_format_program_string (self, result);
     }
   else
-*/
    {
      char *program_string
        = call_formatting_function_format_program_string (self,
@@ -5763,6 +5801,7 @@ html_default_format_navigation_panel (CONVERTER *self,
 
       text_append_n (result, "</div>\n", 7);
     }
+  free (result_buttons.text);
 }
 
 void
diff --git a/tp/Texinfo/XS/convert/get_html_perl_info.c 
b/tp/Texinfo/XS/convert/get_html_perl_info.c
index 9080f06f0c..5b88f66c89 100644
--- a/tp/Texinfo/XS/convert/get_html_perl_info.c
+++ b/tp/Texinfo/XS/convert/get_html_perl_info.c
@@ -887,74 +887,76 @@ html_converter_prepare_output_sv (SV *converter_sv, 
CONVERTER *converter)
 
       hv_number = hv_iterinit (jslicenses_hv);
 
-      converter->jslicenses.number = hv_number;
-      converter->jslicenses.list = (JSLICENSE_FILE_INFO_LIST *)
-       malloc (hv_number * sizeof (JSLICENSE_FILE_INFO_LIST));
-      memset (converter->jslicenses.list, 0,
-              hv_number * sizeof (JSLICENSE_FILE_INFO_LIST));
-
-      for (i = 0; i < hv_number; i++)
+      if (hv_number > 0)
         {
-          I32 hv_files_number;
-          I32 j;
-          HE *next = hv_iternext (jslicenses_hv);
-          SV *category_sv = hv_iterkeysv (next);
-          char *category = (char *) SvPVutf8_nolen (category_sv);
-          SV *files_info_sv = HeVAL(next);
-          HV *files_info_hv = (HV *)SvRV (files_info_sv);
-
-          JSLICENSE_FILE_INFO_LIST *jslicences_files_info
-            = &converter->jslicenses.list[i];
-
-          jslicences_files_info->category = strdup (category);
-
-          hv_files_number = hv_iterinit (files_info_hv);
-          jslicences_files_info->number = hv_files_number;
-          jslicences_files_info->list = (JSLICENSE_FILE_INFO *)
-            malloc (hv_files_number * sizeof (JSLICENSE_FILE_INFO));
-          memset (jslicences_files_info->list, 0,
-                  hv_files_number * sizeof (JSLICENSE_FILE_INFO));
-
-          for (j = 0; j < hv_files_number; j++)
+          converter->jslicenses.number = hv_number;
+          converter->jslicenses.list = (JSLICENSE_FILE_INFO_LIST *)
+           malloc (hv_number * sizeof (JSLICENSE_FILE_INFO_LIST));
+          memset (converter->jslicenses.list, 0,
+                  hv_number * sizeof (JSLICENSE_FILE_INFO_LIST));
+
+          for (i = 0; i < hv_number; i++)
             {
-              HE *next_file = hv_iternext (files_info_hv);
-              SV *filename_sv = hv_iterkeysv (next);
-              char *filename = (char *) SvPVutf8_nolen (filename_sv);
-              SV *file_info_sv = HeVAL(next_file);
-              AV *file_info_av = (AV *)SvRV (file_info_sv);
-              SSize_t file_info_nr;
-              SV **license_sv;
-              SV **url_sv;
-              SV **source_sv;
-
-              JSLICENSE_FILE_INFO *jslicense_file_info
-                = &jslicences_files_info->list[j];
-              jslicense_file_info->filename = strdup (filename);
-
-              file_info_nr = av_top_index (file_info_av) +1;
-              if (file_info_nr != 3)
+              I32 hv_files_number;
+              I32 j;
+              HE *next = hv_iternext (jslicenses_hv);
+              SV *category_sv = hv_iterkeysv (next);
+              char *category = (char *) SvPVutf8_nolen (category_sv);
+              SV *files_info_sv = HeVAL(next);
+              HV *files_info_hv = (HV *)SvRV (files_info_sv);
+
+              JSLICENSE_FILE_INFO_LIST *jslicences_files_info
+                = &converter->jslicenses.list[i];
+
+              jslicences_files_info->category = strdup (category);
+
+              hv_files_number = hv_iterinit (files_info_hv);
+              jslicences_files_info->number = hv_files_number;
+              jslicences_files_info->list = (JSLICENSE_FILE_INFO *)
+                malloc (hv_files_number * sizeof (JSLICENSE_FILE_INFO));
+              memset (jslicences_files_info->list, 0,
+                      hv_files_number * sizeof (JSLICENSE_FILE_INFO));
+
+              for (j = 0; j < hv_files_number; j++)
                 {
-                  fprintf (stderr,
-                           "BUG: %s: %s: jslicence file needs 3 item: %zu\n",
-                           category, filename, file_info_nr);
-                  continue;
+                  HE *next_file = hv_iternext (files_info_hv);
+                  SV *filename_sv = hv_iterkeysv (next);
+                  char *filename = (char *) SvPVutf8_nolen (filename_sv);
+                  SV *file_info_sv = HeVAL(next_file);
+                  AV *file_info_av = (AV *)SvRV (file_info_sv);
+                  SSize_t file_info_nr;
+                  SV **license_sv;
+                  SV **url_sv;
+                  SV **source_sv;
+
+                  JSLICENSE_FILE_INFO *jslicense_file_info
+                    = &jslicences_files_info->list[j];
+                  jslicense_file_info->filename = strdup (filename);
+
+                  file_info_nr = av_top_index (file_info_av) +1;
+                  if (file_info_nr != 3)
+                    {
+                      fprintf (stderr,
+                               "BUG: %s: %s: jslicence file needs 3 item: 
%zu\n",
+                               category, filename, file_info_nr);
+                      continue;
+                    }
+                  license_sv = av_fetch (file_info_av, 0, 0);
+                  if (license_sv && SvOK (*license_sv))
+                    jslicense_file_info->license
+                      = strdup ((char *) SvPVutf8_nolen (*license_sv));
+                  url_sv = av_fetch (file_info_av, 0, 0);
+                  if (url_sv && SvOK (*url_sv))
+                    jslicense_file_info->url
+                      = strdup ((char *) SvPVutf8_nolen (*url_sv));
+                  source_sv = av_fetch (file_info_av, 0, 0);
+                  if (source_sv && SvOK (*source_sv))
+                    jslicense_file_info->source
+                      = strdup ((char *) SvPVutf8_nolen (*source_sv));
                 }
-              license_sv = av_fetch (file_info_av, 0, 0);
-              if (license_sv && SvOK (*license_sv))
-                jslicense_file_info->license
-                  = strdup ((char *) SvPVutf8_nolen (*license_sv));
-              url_sv = av_fetch (file_info_av, 0, 0);
-              if (url_sv && SvOK (*url_sv))
-                jslicense_file_info->url
-                  = strdup ((char *) SvPVutf8_nolen (*url_sv));
-              source_sv = av_fetch (file_info_av, 0, 0);
-              if (source_sv && SvOK (*source_sv))
-                jslicense_file_info->source
-                  = strdup ((char *) SvPVutf8_nolen (*source_sv));
             }
         }
     }
-
   html_converter_prepare_output (converter);
 }
 



reply via email to

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