[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Patrice Dumas |
Date: |
Wed, 2 Oct 2024 06:05:16 -0400 (EDT) |
branch: master
commit a43c2d88a0c003a949f395a6ff2e5037a38e026c
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Tue Jul 30 22:01:12 2024 +0200
* tp/Texinfo/XS/convert/get_html_perl_info.c
(html_converter_initialize_sv): merge conditions on spec_sv for
customized_direction_strings.
---
ChangeLog | 6 ++
tp/Texinfo/XS/convert/get_html_perl_info.c | 112 ++++++++++++-----------------
2 files changed, 53 insertions(+), 65 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 67f64b3b89..d59868e0a3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,12 @@
(converter_initialize): readd converter_initialize that was mistakenly
removed.
+2024-07-30 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/XS/convert/get_html_perl_info.c
+ (html_converter_initialize_sv): merge conditions on spec_sv for
+ customized_direction_strings.
+
2024-07-30 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/Convert/HTML.pm (converter_initialize),
diff --git a/tp/Texinfo/XS/convert/get_html_perl_info.c
b/tp/Texinfo/XS/convert/get_html_perl_info.c
index c09c67dba5..e7966532fb 100644
--- a/tp/Texinfo/XS/convert/get_html_perl_info.c
+++ b/tp/Texinfo/XS/convert/get_html_perl_info.c
@@ -1093,6 +1093,14 @@ html_converter_initialize_sv (SV *converter_sv,
const char *type_name;
HV *direction_hv = 0;
SV **direction_sv;
+
+ type_name = direction_string_type_names[DS_type];
+
+ direction_sv = hv_fetch (customized_direction_strings_hv, type_name,
+ strlen (type_name), 0);
+ if (direction_sv && SvOK (*direction_sv))
+ direction_hv = (HV *) SvRV (*direction_sv);
+
size_t customized_type = DS_type - (TDS_TRANSLATED_MAX_NR);
/* do not use new_directions_strings_type as a 0 for a direction
array
@@ -1102,12 +1110,6 @@ html_converter_initialize_sv (SV *converter_sv,
memset (converter->customized_directions_strings[customized_type], 0,
nr_string_directions * sizeof (char **));
- type_name = direction_string_type_names[DS_type];
-
- direction_sv = hv_fetch (customized_direction_strings_hv, type_name,
- strlen (type_name), 0);
- if (direction_sv && SvOK (*direction_sv))
- direction_hv = (HV *) SvRV (*direction_sv);
for (i = 0; i < nr_string_directions; i++)
{
@@ -1125,74 +1127,54 @@ html_converter_initialize_sv (SV *converter_sv,
spec_sv = hv_fetch (direction_hv, direction_name,
strlen (direction_name), 0);
- if (spec_sv)
+ if (spec_sv && SvOK (*spec_sv))
{
- if (SvOK (*spec_sv))
+ HV *spec_hv = (HV *) SvRV (*spec_sv);
+ SV **context_sv = hv_fetch (spec_hv, "converted",
+ strlen ("converted"), 0);
+
+ converter->
+ customized_directions_strings[customized_type][i]
+ = (char **)
+ malloc (nr_dir_str_contexts * sizeof (char *));
+ memset (converter->
+ customized_directions_strings[customized_type][i],
+ 0, nr_dir_str_contexts * sizeof (char *));
+
+ if (context_sv && SvOK (*context_sv))
{
- HV *spec_hv = (HV *) SvRV (*spec_sv);
- SV **context_sv = hv_fetch (spec_hv, "converted",
- strlen ("converted"),
0);
-
- converter->
- customized_directions_strings[customized_type][i]
- = (char **)
- malloc (nr_dir_str_contexts * sizeof (char *));
- memset (converter->
- customized_directions_strings[customized_type][i],
- 0, nr_dir_str_contexts * sizeof (char *));
-
- if (context_sv && SvOK (*context_sv))
+ int j;
+ HV *context_hv = (HV *) SvRV (*context_sv);
+ for (j = 0; j < nr_dir_str_contexts; j++)
{
- int j;
- HV *context_hv = (HV *) SvRV (*context_sv);
- for (j = 0; j < nr_dir_str_contexts; j++)
- {
- const char *context_name
- = direction_string_context_names[j];
+ const char *context_name
+ = direction_string_context_names[j];
- SV **value_sv
- = hv_fetch (context_hv, context_name,
- strlen (context_name), 0);
+ SV **value_sv
+ = hv_fetch (context_hv, context_name,
+ strlen (context_name), 0);
- if (value_sv && SvOK (*value_sv))
- {
- const char *value
- = (char *) SvPVutf8_nolen
(*value_sv);
+ if (value_sv && SvOK (*value_sv))
+ {
+ const char *value
+ = (char *) SvPVutf8_nolen (*value_sv);
converter->customized_directions_strings
- [customized_type][i][j]
- = strdup (value);
- }
- /* in general no string value, it is completed later on
- in C code
- else
- {
- fprintf (stderr,
- "customized_direction_strings: %s: %s: %s: no value\n",
- type_name, direction_name,
- context_name);
- }
- */
+ [customized_type][i][j]
+ = strdup (value);
}
+ /* in general no string value, it is completed later on
+ in C code
+ else
+ {
+ fprintf (stderr,
+ "customized_direction_strings: %s: %s: %s: no value\n",
+ type_name, direction_name,
+ context_name);
+ }
+ */
}
- /* case of customized string undef
- else
- {
- fprintf (stderr,
- "customized_direction_strings: %s: %s: spec SvTYPE %d no converted\n",
- type_name, direction_name,
- SvTYPE (SvRV (*spec_sv)));
- }
- */
- continue;
- }
- /* not clear that it can happen
- else
- {
- fprintf (stderr,
- "customized_direction_strings: %s: %s: spec undef\n",
- type_name, direction_name);
}
- */
+ continue;
}
/* for debug, case of directions not customized
else