texinfo-commits
[Top][All Lists]
Advanced

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

[no subject]


From: Patrice Dumas
Date: Fri, 10 Nov 2023 12:50:26 -0500 (EST)

branch: master
commit a6b77aac3db91c83acf338aecf94de31b2712b53
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Fri Nov 10 18:48:09 2023 +0100

    * tp/Texinfo/XS/convert/convert_html.c (html_set_pages_files): strdup
    on the special_unit_filename for associated output units.
    
    * tp/Texinfo/XS/convert/convert_html.c
    (special_unit_variety_direction_index, html_converter_initialize),
    tp/Texinfo/XS/main/converter_types.h (CONVERTER):
    remove varieties_direction_index, do the index computation in
    special_unit_variety_direction_index.
    
    * tp/Texinfo/XS/convert/convert_html.c (reset_html_targets)
    (html_initialize_output_state, html_finalize_output_state): add
    reset_html_targets to free targets contents, called in
    html_finalize_output_state both for html_targets and
    html_special_targets.
    
    * tp/Texinfo/XS/convert/convert_html.c (html_finalize_output_state):
    clear seen_ids, free special_units_direction_name,
    output_unit_file_indices and special_unit_file_indices.
    
    * tp/Texinfo/XS/convert/build_html_perl_state.c
    (build_html_global_units_directions)
    (pass_html_global_units_directions),
    tp/Texinfo/XS/convert/convert_html.c
    (html_prepare_output_units_global_targets),
    tp/Texinfo/XS/main/converter_types.h (CONVERTER): change
    special_units_direction_name to be a list of SPECIAL_UNIT_DIRECTION,
    not a list of pointers.
    
    * tp/Texinfo/XS/main/get_perl_info.c (set_translated_commands),
    tp/Texinfo/XS/main/convert_utils.c (translated_command_tree),
    tp/Texinfo/XS/main/converter_types.h (CONVERTER): change
    translated_commands to be a list of TRANSLATED_COMMAND, not a list of
    pointers.
    
    * tp/Texinfo/XS/convert/convert_html.c (html_set_pages_files): no
    memset for special_unit_file_indices and output_unit_file_indices as
    they are filled anyway.
    
    * tp/Texinfo/XS/convert/build_html_perl_state.c
    (build_html_translated_names): use enum and SUIT_type_none.
---
 ChangeLog                                     |  43 +++++++++
 tp/TODO                                       |  27 ++++++
 tp/Texinfo/XS/convert/build_html_perl_state.c |  22 +++--
 tp/Texinfo/XS/convert/build_html_perl_state.h |   2 +-
 tp/Texinfo/XS/convert/convert_html.c          | 122 ++++++++++++++------------
 tp/Texinfo/XS/main/convert_utils.c            |  19 ++--
 tp/Texinfo/XS/main/converter_types.h          |  14 ++-
 tp/Texinfo/XS/main/get_perl_info.c            |  14 ++-
 tp/Texinfo/XS/main/utils.c                    |   1 +
 9 files changed, 174 insertions(+), 90 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 4266c8ab33..84696140fd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,46 @@
+2023-11-10  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/XS/convert/convert_html.c (html_set_pages_files): strdup
+       on the special_unit_filename for associated output units.
+
+       * tp/Texinfo/XS/convert/convert_html.c
+       (special_unit_variety_direction_index, html_converter_initialize),
+       tp/Texinfo/XS/main/converter_types.h (CONVERTER):
+       remove varieties_direction_index, do the index computation in
+       special_unit_variety_direction_index.
+
+       * tp/Texinfo/XS/convert/convert_html.c (reset_html_targets)
+       (html_initialize_output_state, html_finalize_output_state): add
+       reset_html_targets to free targets contents, called in
+       html_finalize_output_state both for html_targets and
+       html_special_targets.
+
+       * tp/Texinfo/XS/convert/convert_html.c (html_finalize_output_state):
+       clear seen_ids, free special_units_direction_name,
+       output_unit_file_indices and special_unit_file_indices.
+
+       * tp/Texinfo/XS/convert/build_html_perl_state.c
+       (build_html_global_units_directions)
+       (pass_html_global_units_directions),
+       tp/Texinfo/XS/convert/convert_html.c
+       (html_prepare_output_units_global_targets),
+       tp/Texinfo/XS/main/converter_types.h (CONVERTER): change
+       special_units_direction_name to be a list of SPECIAL_UNIT_DIRECTION,
+       not a list of pointers.
+
+       * tp/Texinfo/XS/main/get_perl_info.c (set_translated_commands),
+       tp/Texinfo/XS/main/convert_utils.c (translated_command_tree),
+       tp/Texinfo/XS/main/converter_types.h (CONVERTER): change
+       translated_commands to be a list of TRANSLATED_COMMAND, not a list of
+       pointers.
+
+       * tp/Texinfo/XS/convert/convert_html.c (html_set_pages_files): no
+       memset for special_unit_file_indices and output_unit_file_indices as
+       they are filled anyway.
+
+       * tp/Texinfo/XS/convert/build_html_perl_state.c
+       (build_html_translated_names): use enum and SUIT_type_none.
+
 2023-11-10  Gavin Smith <gavinsmith0123@gmail.com>
 
        Revert change on 2023-11-09 "Locale-independent XS paragraph
diff --git a/tp/TODO b/tp/TODO
index e05e39ea56..66dc0dc451 100644
--- a/tp/TODO
+++ b/tp/TODO
@@ -36,6 +36,33 @@ TEXINFO_XS_CONVERT=only         => try to run only XS code
 It is not clear that it is useful, though, 0 and 1 corresponding to
 omit and only could be sufficient.
 
+Nothing to do:
+command_special_variety_name_index
+
+converter todo get from perl, code in html converter
+directions_strings
+
+converter output state reset
+global_units_directions html_initialize_output_state
+special_unit_info_tree html_finalize_output_state
+html_targets html_finalize_output_state
+seen_ids html_finalize_output_state
+html_special_targets html_finalize_output_state
+
+converter free
+special_units_direction_name html_finalize_output_state
+output_unit_file_indices html_finalize_output_state
+special_unit_file_indices html_finalize_output_state
+global_units_directions
+html_targets
+seen_ids
+html_special_targets
+special_unit_info_tree
+special_unit_varieties
+pre_class_types
+translated_commands translated_command->translation:strdup
+
+
 Bugs
 ====
 
diff --git a/tp/Texinfo/XS/convert/build_html_perl_state.c 
b/tp/Texinfo/XS/convert/build_html_perl_state.c
index ea4702c37f..c800ed83fe 100644
--- a/tp/Texinfo/XS/convert/build_html_perl_state.c
+++ b/tp/Texinfo/XS/convert/build_html_perl_state.c
@@ -62,6 +62,9 @@
      free below is redirected to Perl's implementation.  This could
      cause crashes if the two malloc/free implementations were different.  */
 
+/* this function is used to set the initial targets information. */
+/* Dynamical changes are done in other functions, build_html_translated_names
+   .... */
 HV *
 build_html_element_targets (HTML_TARGET_LIST *html_targets)
 {
@@ -258,11 +261,9 @@ build_html_files_source_info (FILE_SOURCE_INFO_LIST 
*files_source_info)
 
 HV *
 build_html_global_units_directions (OUTPUT_UNIT **global_units_directions,
-                       SPECIAL_UNIT_DIRECTION **special_units_direction_name)
+                       SPECIAL_UNIT_DIRECTION *special_units_direction_name)
 {
   int i;
-  SPECIAL_UNIT_DIRECTION **s;
-  SPECIAL_UNIT_DIRECTION *special_unit_direction;
   HV *hv;
 
   dTHX;
@@ -282,8 +283,12 @@ build_html_global_units_directions (OUTPUT_UNIT 
**global_units_directions,
         }
     }
 
-  for (s = special_units_direction_name; (special_unit_direction = *s) ; s++)
+  /* html_prepare_units_directions_files is allocated because
+     html_prepare_units_directions_files was called before */
+  for (i = 0; special_units_direction_name[i].output_unit; i++)
     {
+      SPECIAL_UNIT_DIRECTION *special_unit_direction
+       = &special_units_direction_name[i];
       char *direction_name = special_unit_direction->direction;
       OUTPUT_UNIT *output_unit = special_unit_direction->output_unit;
       hv_store (hv, direction_name, strlen (direction_name),
@@ -296,7 +301,7 @@ build_html_global_units_directions (OUTPUT_UNIT 
**global_units_directions,
 void
 pass_html_global_units_directions (SV *converter_sv,
                        OUTPUT_UNIT **global_units_directions,
-                       SPECIAL_UNIT_DIRECTION **special_units_direction_name)
+                       SPECIAL_UNIT_DIRECTION *special_units_direction_name)
 {
   HV *global_units_directions_hv;
   SV *global_units_directions_sv;
@@ -395,10 +400,11 @@ build_html_translated_names (HV *hv, CONVERTER *converter)
   special_unit_info_hv = (HV *) SvRV (*special_unit_info_sv);
 
   /* reset with empty hash */
-  for (j = 0; translated_special_unit_info[j].tree_type >= 0; j++)
+  for (j = 0; translated_special_unit_info[j].tree_type != SUIT_type_none; j++)
     {
-      int tree_type = translated_special_unit_info[j].string_type;
-      const char *type_name = special_unit_info_type_names[tree_type];
+      enum special_unit_info_type string_type
+        = translated_special_unit_info[j].string_type;
+      const char *type_name = special_unit_info_type_names[string_type];
       char *key;
       HV *special_unit_hv = newHV ();
       xasprintf (&key, "%s_tree", type_name);
diff --git a/tp/Texinfo/XS/convert/build_html_perl_state.h 
b/tp/Texinfo/XS/convert/build_html_perl_state.h
index e5337a1dc0..ace069605f 100644
--- a/tp/Texinfo/XS/convert/build_html_perl_state.h
+++ b/tp/Texinfo/XS/convert/build_html_perl_state.h
@@ -24,7 +24,7 @@ void pass_converter_errors (ERROR_MESSAGE_LIST 
*error_messages,
 SV *build_html_files_source_info (FILE_SOURCE_INFO_LIST *files_source_info);
 void pass_html_global_units_directions (SV *converter_sv,
                        OUTPUT_UNIT **global_units_directions,
-                       SPECIAL_UNIT_DIRECTION **special_units_direction_name);
+                       SPECIAL_UNIT_DIRECTION *special_units_direction_name);
 void pass_html_elements_in_file_count (SV *converter_sv,
                    FILE_NAME_PATH_COUNTER_LIST *output_unit_files);
 
diff --git a/tp/Texinfo/XS/convert/convert_html.c 
b/tp/Texinfo/XS/convert/convert_html.c
index 9a643393f0..fcdd056415 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -162,17 +162,12 @@ int
 special_unit_variety_direction_index (CONVERTER *self,
                                       char *special_unit_variety)
 {
-  int i;
-  VARIETY_DIRECTION_INDEX **varieties_direction_index
-    = self->varieties_direction_index;
-  for (i = 0; varieties_direction_index[i] != 0; i++)
-    {
-      VARIETY_DIRECTION_INDEX *variety_direction_index
-        = varieties_direction_index[i];
-      if (!strcmp (variety_direction_index->special_unit_variety,
-                   special_unit_variety))
-        return variety_direction_index->direction_index;
-    }
+  /* number is index +1 */
+  size_t number = find_string (&self->special_unit_varieties,
+                               special_unit_variety);
+  int i = number -1;
+  if (i >= 0)
+    return D_Last +1 +i;
   return -1;
 }
 
@@ -714,6 +709,8 @@ void register_pre_class_command (enum command_id cmd, enum 
command_id main_cmd)
   html_commands_data[cmd].flags |= HF_pre_class;
 }
 
+/* used for diverse elements: tree units, indices, footnotes, special
+  elements, contents elements... */
 static HTML_TARGET *
 add_element_target_to_list (HTML_TARGET_LIST *targets,
                             ELEMENT *element, char *target)
@@ -1453,7 +1450,7 @@ html_prepare_output_units_global_targets (CONVERTER *self,
 {
   int i;
   int all_special_units_nr = 0;
-  int s = 0;
+  int s;
   OUTPUT_UNIT_LIST *output_units
     = retrieve_output_units (output_units_descriptor);
 
@@ -1550,19 +1547,20 @@ html_prepare_output_units_global_targets (CONVERTER 
*self,
         all_special_units_nr += units_list->number;
     }
 
-  self->special_units_direction_name = (SPECIAL_UNIT_DIRECTION **)
-   malloc (sizeof (SPECIAL_UNIT_DIRECTION *) * (all_special_units_nr+1));
+  self->special_units_direction_name = (SPECIAL_UNIT_DIRECTION *)
+   malloc (sizeof (SPECIAL_UNIT_DIRECTION) * (all_special_units_nr+1));
   memset (self->special_units_direction_name, 0,
-          sizeof (SPECIAL_UNIT_DIRECTION *) * (all_special_units_nr+1));
+          sizeof (SPECIAL_UNIT_DIRECTION) * (all_special_units_nr+1));
 
+  s = 0;
   for (i = 0; i < 2; i++)
     {
-      int j;
       int special_units_descriptor = special_output_units_lists[i];
       OUTPUT_UNIT_LIST *units_list
        = retrieve_output_units (special_units_descriptor);
       if (units_list && units_list->number)
         {
+          int j;
           for (j = 0; j < units_list->number; j++)
             {
               OUTPUT_UNIT *special_unit = units_list->list[j];
@@ -1573,11 +1571,8 @@ html_prepare_output_units_global_targets (CONVERTER 
*self,
               self->global_units_directions[special_unit_direction_index]
                 = special_unit;
 
-              self->special_units_direction_name[s] =
-               (SPECIAL_UNIT_DIRECTION *)
-                malloc (sizeof (SPECIAL_UNIT_DIRECTION));
-              self->special_units_direction_name[s]->output_unit = 
special_unit;
-              self->special_units_direction_name[s]->direction
+              self->special_units_direction_name[s].output_unit = special_unit;
+              self->special_units_direction_name[s].direction
                 = special_unit_info (self, SUI_type_direction,
                                            special_unit_variety);
               s++;
@@ -1939,7 +1934,6 @@ html_set_pages_files (CONVERTER *self, OUTPUT_UNIT_LIST 
*output_units,
   self->output_unit_file_indices = (size_t *)
     malloc (output_units->number * sizeof (size_t));
 
-  memset (self->output_unit_file_indices, 0, output_units->number);
   for (i = 0; i < output_units->number; i++)
     {
       size_t output_unit_file_idx = 0;
@@ -1999,11 +1993,9 @@ html_set_pages_files (CONVERTER *self, OUTPUT_UNIT_LIST 
*output_units,
 
   if (special_units && special_units->number)
     {
+      int i;
       self->special_unit_file_indices = (size_t *)
         malloc (special_units->number * sizeof (size_t));
-      memset (self->special_unit_file_indices, 0,
-                       special_units->number);
-      int i;
       for (i = 0; i < special_units->number; i++)
         {
           size_t special_unit_file_idx = 0;
@@ -2081,7 +2073,7 @@ html_set_pages_files (CONVERTER *self, OUTPUT_UNIT_LIST 
*output_units,
           else
             {
               if (associated_output_unit)
-                filename = associated_output_unit->unit_filename;
+                filename = strdup (associated_output_unit->unit_filename);
               element_target->special_unit_filename = filename;
             }
 
@@ -2449,27 +2441,6 @@ html_converter_initialize (CONVERTER *self)
     = (OUTPUT_UNIT **) malloc ((D_Last + nr_special_units+1)
                                * sizeof (OUTPUT_UNIT));
 
-  /* prepare mapping of variety names to index in global_units_directions */
-  self->varieties_direction_index = (VARIETY_DIRECTION_INDEX **)
-        malloc (sizeof (VARIETY_DIRECTION_INDEX *) * (nr_special_units +1));
-  if (nr_special_units)
-    {
-      STRING_LIST *special_unit_varieties = &self->special_unit_varieties;
-
-      for (i = 0; i < special_unit_varieties->number; i++)
-        {
-          VARIETY_DIRECTION_INDEX *variety_direction_index
-            = (VARIETY_DIRECTION_INDEX *)
-                 malloc (sizeof (VARIETY_DIRECTION_INDEX));
-          self->varieties_direction_index[i] = variety_direction_index;
-          variety_direction_index->special_unit_variety
-            = special_unit_varieties->list[i];
-          variety_direction_index->direction_index
-            = D_Last +1 +i;
-        }
-      self->varieties_direction_index[i] = 0;
-   }
-
   /* note that we allocate the same size as no_arg_formatted_cmd
      even though in general there are much less translated commands,
      for simplicity */
@@ -2497,22 +2468,38 @@ html_converter_initialize (CONVERTER *self)
 }
 
 void
-html_initialize_output_state (CONVERTER *self, char *context)
+reset_html_targets (HTML_TARGET_LIST *targets)
 {
-  int i;
-  /* targets and directions */
+  size_t i;
 
-  /* used for diverse elements: tree units, indices, footnotes, special
-    elements, contents elements... */
-  memset (&self->html_targets, 0, sizeof (HTML_TARGET_LIST));
-  memset (&self->seen_ids, 0, sizeof (STRING_LIST));
+  if (targets->number)
+    {
+      for (i = 0; i < targets->number; i++)
+        {
+          HTML_TARGET *html_target = &targets->list[i];
+          /* setup before conversion */
+          free (html_target->target);
+          free (html_target->special_unit_filename);
+          free (html_target->node_filename);
+          free (html_target->section_filename);
+          free (html_target->contents_target);
+          free (html_target->shortcontents_target);
+
+          /* TODO free fields changed during conversion */
+        }
+      memset (targets->list, 0,
+              sizeof (HTML_TARGET) * targets->number);
+      targets->number = 0;
+    }
+}
+
+void
+html_initialize_output_state (CONVERTER *self, char *context)
+{
+  /* directions */
   memset (self->global_units_directions, 0,
     (D_Last + self->special_unit_varieties.number+1) * sizeof (OUTPUT_UNIT));
 
-  for (i = 0; i < ST_footnote_location+1; i++)
-    {
-      memset (&self->html_special_targets[i], 0, sizeof (HTML_TARGET_LIST));
-    }
 
   self->current_formatting_references = &self->formatting_references[0];
   self->current_commands_conversion = &self->commands_conversion[0];
@@ -2527,7 +2514,21 @@ html_initialize_output_state (CONVERTER *self, char 
*context)
 void
 html_finalize_output_state (CONVERTER *self)
 {
+  int i;
   reset_translated_special_unit_info_tree (self);
+  /* targets */
+  reset_html_targets (&self->html_targets);
+  clear_strings_list (&self->seen_ids);
+  for (i = 0; i < ST_footnote_location+1; i++)
+    {
+      reset_html_targets (&self->html_special_targets[i]);
+    }
+  free (self->special_units_direction_name);
+  self->special_units_direction_name = 0;
+  free (self->output_unit_file_indices);
+  self->output_unit_file_indices = 0;
+  free (self->special_unit_file_indices);
+  self->special_unit_file_indices = 0;
   html_pop_document_context (self);
 }
 
@@ -2811,7 +2812,12 @@ html_translate_names (CONVERTER *self)
                      = find_element_target (&self->html_targets, command);
                    if (target)
                      {
+       /* the tree is a reference to special_unit_info_tree, so it should
+          not be freed, but need to be reset to trigger the creation of the
+          special_unit_info_tree tree when needed */
                        target->tree = 0;
+       /* TODO check if there is a need to free when the code setting
+               those fields is done */
                        target->string = 0;
                        target->text = 0;
                        /* gather elements to pass information to perl */
diff --git a/tp/Texinfo/XS/main/convert_utils.c 
b/tp/Texinfo/XS/main/convert_utils.c
index cd302a9473..cd818b2209 100644
--- a/tp/Texinfo/XS/main/convert_utils.c
+++ b/tp/Texinfo/XS/main/convert_utils.c
@@ -539,18 +539,17 @@ definition_category_tree (OPTIONS * options, ELEMENT 
*current)
 ELEMENT *
 translated_command_tree (CONVERTER *self, enum command_id cmd)
 {
-  if (self->translated_commands)
+  size_t i;
+  for (i = 0; self->translated_commands[i].cmd; i++)
     {
-      TRANSLATED_COMMAND **i;
-      TRANSLATED_COMMAND *tc;
-      for (i = self->translated_commands; (tc = *i); i++)
+      TRANSLATED_COMMAND *translated_command
+        = &self->translated_commands[i];
+      if (translated_command->cmd == cmd
+          && translated_command->translation)
         {
-          if (tc->cmd == cmd && tc->translation)
-            {
-              ELEMENT *result = gdt_tree (tc->translation, 0, self->conf,
-                                          0, 0, 0);
-              return result;
-            }
+          ELEMENT *result = gdt_tree (translated_command->translation, 0,
+                                      self->conf, 0, 0, 0);
+          return result;
         }
     }
   return 0;
diff --git a/tp/Texinfo/XS/main/converter_types.h 
b/tp/Texinfo/XS/main/converter_types.h
index b9f51f685f..100209f6b2 100644
--- a/tp/Texinfo/XS/main/converter_types.h
+++ b/tp/Texinfo/XS/main/converter_types.h
@@ -218,9 +218,16 @@ typedef struct HTML_TARGET {
     char *shortcontents_target;
 
     char *text;
+    char *text_nonumber;
     ELEMENT *tree;
     ELEMENT *tree_nonumber;
     char *string;
+    char *string_nonumber;
+    char *filename;
+    /*
+    ELEMENT *node_command;
+    ELEMENT *root_element_command;
+    */
 } HTML_TARGET;
 
 typedef struct HTML_TARGET_LIST {
@@ -371,7 +378,7 @@ typedef struct CONVERTER {
     ERROR_MESSAGE_LIST *error_messages;
     MERGED_INDEX **index_entries;
     INDEX_SORTED_BY_LETTER **index_entries_by_letter;
-    TRANSLATED_COMMAND **translated_commands;
+    TRANSLATED_COMMAND *translated_commands;
     EXPANDED_FORMAT *expanded_formats;
 
   /* output unit files API */
@@ -403,6 +410,7 @@ typedef struct CONVERTER {
     FORMATTING_REFERENCE types_conversion[ET_special_unit_element+1];
     FORMATTING_REFERENCE 
css_string_types_conversion[ET_special_unit_element+1];
     FORMATTING_REFERENCE output_units_conversion[OU_special_unit+1];
+    STRING_LIST special_unit_varieties;
     char **special_unit_info[SUI_type_heading+1];
 
     /* set for a converter, modified in a document */
@@ -410,10 +418,8 @@ typedef struct CONVERTER {
 
     /* set for a document */
     OUTPUT_UNIT **global_units_directions;
-    SPECIAL_UNIT_DIRECTION **special_units_direction_name;
+    SPECIAL_UNIT_DIRECTION *special_units_direction_name;
     ELEMENT **special_unit_info_tree[SUIT_type_heading+1];
-    STRING_LIST special_unit_varieties;
-    VARIETY_DIRECTION_INDEX **varieties_direction_index;
     STRING_LIST seen_ids;
     HTML_TARGET_LIST html_targets;
     HTML_TARGET_LIST html_special_targets[ST_footnote_location+1];
diff --git a/tp/Texinfo/XS/main/get_perl_info.c 
b/tp/Texinfo/XS/main/get_perl_info.c
index 694b4a8610..34466299a1 100644
--- a/tp/Texinfo/XS/main/get_perl_info.c
+++ b/tp/Texinfo/XS/main/get_perl_info.c
@@ -307,10 +307,10 @@ set_translated_commands (CONVERTER *converter, HV *hv_in)
 
       hv_number = hv_iterinit (translated_commands_hv);
 
-      converter->translated_commands = (TRANSLATED_COMMAND **)
-        malloc ((hv_number +1) * sizeof (TRANSLATED_COMMAND *));
+      converter->translated_commands = (TRANSLATED_COMMAND *)
+        malloc ((hv_number +1) * sizeof (TRANSLATED_COMMAND));
       memset (converter->translated_commands, 0,
-              (hv_number +1) * sizeof (TRANSLATED_COMMAND *));
+              (hv_number +1) * sizeof (TRANSLATED_COMMAND));
 
       for (i = 0; i < hv_number; i++)
         {
@@ -327,12 +327,8 @@ set_translated_commands (CONVERTER *converter, HV *hv_in)
               else
                 {
                   char *tmp_spec = (char *) SvPVutf8_nolen (translation_sv);
-                  TRANSLATED_COMMAND *translated_command;
-
-                  converter->translated_commands[i] = (TRANSLATED_COMMAND *)
-                    malloc (sizeof (TRANSLATED_COMMAND));
-                  translated_command = converter->translated_commands[i];
-
+                  TRANSLATED_COMMAND *translated_command
+                    = &converter->translated_commands[i];
                   translated_command->translation = strdup (tmp_spec);
                   translated_command->cmd = cmd;
                 }
diff --git a/tp/Texinfo/XS/main/utils.c b/tp/Texinfo/XS/main/utils.c
index e29cda4330..1fea07aebd 100644
--- a/tp/Texinfo/XS/main/utils.c
+++ b/tp/Texinfo/XS/main/utils.c
@@ -101,6 +101,7 @@ const char *special_unit_info_type_names[SUI_type_heading + 
1] =
 
 TRANSLATED_SUI_ASSOCIATION translated_special_unit_info[] = {
   {SUIT_type_heading, SUI_type_heading},
+  /* these special types end the list */
   {SUIT_type_none, SUI_type_none},
 };
 



reply via email to

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