[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/XS/convert/convert_html.c (html_conv
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/XS/convert/convert_html.c (html_converter_initialize), tp/Texinfo/XS/main/get_perl_info.c (html_converter_initialize_sv): move allocation of space for translated tree types from html_converter_initialize_sv to html_converter_initialize. |
Date: |
Sun, 05 Nov 2023 17:52:47 -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 d4d8c6b6ea * tp/Texinfo/XS/convert/convert_html.c
(html_converter_initialize), tp/Texinfo/XS/main/get_perl_info.c
(html_converter_initialize_sv): move allocation of space for translated tree
types from html_converter_initialize_sv to html_converter_initialize.
d4d8c6b6ea is described below
commit d4d8c6b6eafa93d9b03d663281d833ca9ace7ff7
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Nov 5 23:52:39 2023 +0100
* tp/Texinfo/XS/convert/convert_html.c (html_converter_initialize),
tp/Texinfo/XS/main/get_perl_info.c (html_converter_initialize_sv):
move allocation of space for translated tree types from
html_converter_initialize_sv to html_converter_initialize.
* tp/Texinfo/XS/main/converter_types.h (CONVERTER): put
special_unit_varieties directly in the structure. Update codes using
the strucutre.
---
ChangeLog | 11 +++++++++++
tp/Texinfo/XS/convert/convert_html.c | 24 +++++++++++++++++-------
tp/Texinfo/XS/main/converter_types.h | 2 +-
tp/Texinfo/XS/main/get_perl_info.c | 17 +----------------
4 files changed, 30 insertions(+), 24 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 3fa97232a6..086041315e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2023-11-05 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/XS/convert/convert_html.c (html_converter_initialize),
+ tp/Texinfo/XS/main/get_perl_info.c (html_converter_initialize_sv):
+ move allocation of space for translated tree types from
+ html_converter_initialize_sv to html_converter_initialize.
+
+ * tp/Texinfo/XS/main/converter_types.h (CONVERTER): put
+ special_unit_varieties directly in the structure. Update codes using
+ the strucutre.
+
2023-11-05 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/XS/main/get_perl_info.c (converter_initialize)
diff --git a/tp/Texinfo/XS/convert/convert_html.c
b/tp/Texinfo/XS/convert/convert_html.c
index 2f2f955049..db5acaba53 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -253,7 +253,7 @@ html_get_tree_root_element (CONVERTER *self, ELEMENT
*command,
if (cmd_variety_index.cmd == current->cmd)
{
char *special_unit_variety
- = self->special_unit_varieties->list[cmd_variety_index.index];
+ = self->special_unit_varieties.list[cmd_variety_index.index];
int special_unit_direction_index
= special_unit_variety_direction_index (self,
special_unit_variety);
@@ -422,7 +422,7 @@ special_unit_info_tree (CONVERTER *self, enum
special_unit_info_tree type,
char *special_unit_variety)
{
/* number is index +1 */
- size_t number = find_string (self->special_unit_varieties,
+ size_t number = find_string (&self->special_unit_varieties,
special_unit_variety);
int j;
int i = number -1;
@@ -455,7 +455,7 @@ special_unit_info (CONVERTER *self, enum
special_unit_info_type type,
char *special_unit_variety)
{
/* number is index +1 */
- size_t number = find_string (self->special_unit_varieties,
+ size_t number = find_string (&self->special_unit_varieties,
special_unit_variety);
int i = number -1;
@@ -498,7 +498,7 @@ prepare_special_units (CONVERTER *self, int
output_units_descriptor,
int *associated_special_units_descriptor_ref)
{
int i;
- STRING_LIST *special_unit_varieties = self->special_unit_varieties;
+ STRING_LIST *special_unit_varieties = &self->special_unit_varieties;
SPECIAL_UNIT_ORDER *special_units_order;
OUTPUT_UNIT *previous_output_unit = 0;
@@ -2392,7 +2392,17 @@ html_converter_initialize (CONVERTER *self)
/* initialization needing some information from perl */
- nr_special_units = self->special_unit_varieties->number;
+ nr_special_units = self->special_unit_varieties.number;
+
+ /* allocate space for translated tree types, they will be created
+ on-demand during the conversion */
+ for (i = 0; i < SUIT_type_heading+1; i++)
+ {
+ self->special_unit_info_tree[i] = (ELEMENT **)
+ malloc ((nr_special_units +1) * sizeof (ELEMENT *));
+ memset (self->special_unit_info_tree[i], 0,
+ (nr_special_units +1) * sizeof (ELEMENT *));
+ }
self->global_units_directions
= (OUTPUT_UNIT **) malloc ((D_Last + nr_special_units+1)
@@ -2414,7 +2424,7 @@ html_converter_initialize (CONVERTER *self)
{
char *special_unit_variety = command_special_unit_variety[i].variety;
/* number is index +1 */
- size_t number = find_string (self->special_unit_varieties,
+ size_t number = find_string (&self->special_unit_varieties,
special_unit_variety);
enum command_id cmd = command_special_unit_variety[i].cmd;
html_commands_data[cmd].flags |= HF_special_variety;
@@ -2699,7 +2709,7 @@ void
html_translate_names (CONVERTER *self)
{
int j;
- STRING_LIST *special_unit_varieties = self->special_unit_varieties;
+ STRING_LIST *special_unit_varieties = &self->special_unit_varieties;
if (self->conf->DEBUG > 0)
{
diff --git a/tp/Texinfo/XS/main/converter_types.h
b/tp/Texinfo/XS/main/converter_types.h
index c2f59efb0c..a66eaf5ac3 100644
--- a/tp/Texinfo/XS/main/converter_types.h
+++ b/tp/Texinfo/XS/main/converter_types.h
@@ -401,7 +401,7 @@ typedef struct CONVERTER {
SPECIAL_UNIT_DIRECTION **special_units_direction_name;
char **special_unit_info[SUI_type_heading+1];
ELEMENT **special_unit_info_tree[SUIT_type_heading+1];
- STRING_LIST *special_unit_varieties;
+ STRING_LIST special_unit_varieties;
VARIETY_DIRECTION_INDEX **varieties_direction_index;
STRING_LIST *seen_ids;
HTML_TARGET_LIST *html_targets;
diff --git a/tp/Texinfo/XS/main/get_perl_info.c
b/tp/Texinfo/XS/main/get_perl_info.c
index d398b0a8bb..499a06bd84 100644
--- a/tp/Texinfo/XS/main/get_perl_info.c
+++ b/tp/Texinfo/XS/main/get_perl_info.c
@@ -757,26 +757,11 @@ html_converter_initialize_sv (SV *converter_sv,
SV **special_unit_info_sv;
HV *special_unit_info_hv;
- STRING_LIST *special_unit_varieties
- = (STRING_LIST *) malloc (sizeof (STRING_LIST));
- memset (special_unit_varieties, 0, sizeof (STRING_LIST));
+ STRING_LIST *special_unit_varieties = &converter->special_unit_varieties;
if (sorted_special_unit_varieties_sv)
add_svav_to_string_list (*sorted_special_unit_varieties_sv,
special_unit_varieties, 0);
- /* allocate space for translated tree types, but do not
- get from perl, it will be created for the conversion */
- for (j = 0; j < SUIT_type_heading+1; j++)
- {
- converter->special_unit_info_tree[j]
- = (ELEMENT **)
- malloc ((special_unit_varieties->number +1) * sizeof (ELEMENT *));
- memset (converter->special_unit_info_tree[j], 0,
- (special_unit_varieties->number +1) * sizeof (ELEMENT *));
- }
-
- converter->special_unit_varieties = special_unit_varieties;
-
FETCH(special_unit_info);
special_unit_info_hv = (HV *) SvRV(*special_unit_info_sv);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/XS/convert/convert_html.c (html_converter_initialize), tp/Texinfo/XS/main/get_perl_info.c (html_converter_initialize_sv): move allocation of space for translated tree types from html_converter_initialize_sv to html_converter_initialize.,
Patrice Dumas <=