[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Patrice Dumas |
Date: |
Sun, 19 Jan 2025 13:37:05 -0500 (EST) |
branch: master
commit a787522123715cd8b42f95c445d37810eecad032
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Jan 19 19:37:10 2025 +0100
Keep converter SV instead of HV in C
* tp/Texinfo/XS/convert/ConvertXS.xs (generic_converter_init),
tp/Texinfo/XS/main/converter_types.h (CONVERTER): keep the converter
SV instead of the converter HV in C.
* tp/Texinfo/XS/convert/call_conversion_perl.c
(call_converter_output, call_sort_element_counts): no need to reset
the converter stash anymore.
* tp/Texinfo/XS/convert/build_html_perl_state.c,
tp/Texinfo/XS/convert/call_html_perl_function.c,
tp/Texinfo/XS/main/call_perl_function.c,
tp/Texinfo/XS/main/build_perl_info.c: update for the change in
CONVERTER, change variable names.
* tp/Texinfo/XS/convert/call_conversion_perl.c
(call_converter_output): add a SvREFCNT_inc before the second Perl
function call in call_converter_output.
* tp/Texinfo/XS/convert/converter.c (free_generic_converter):
unregister converter Perl object.
---
ChangeLog | 25 +++++++
tp/Texinfo/XS/convert/ConvertXS.xs | 4 +-
tp/Texinfo/XS/convert/build_html_perl_state.c | 10 +--
tp/Texinfo/XS/convert/call_conversion_perl.c | 22 +++---
tp/Texinfo/XS/convert/call_html_perl_function.c | 89 +++++++++++++------------
tp/Texinfo/XS/convert/converter.c | 4 +-
tp/Texinfo/XS/main/build_perl_info.c | 5 +-
tp/Texinfo/XS/main/call_perl_function.c | 2 +-
tp/Texinfo/XS/main/converter_types.h | 4 +-
9 files changed, 95 insertions(+), 70 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 28ba01e70f..4e2050693c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,28 @@
+2025-01-19 Patrice Dumas <pertusus@free.fr>
+
+ Keep converter SV instead of HV in C
+
+ * tp/Texinfo/XS/convert/ConvertXS.xs (generic_converter_init),
+ tp/Texinfo/XS/main/converter_types.h (CONVERTER): keep the converter
+ SV instead of the converter HV in C.
+
+ * tp/Texinfo/XS/convert/call_conversion_perl.c
+ (call_converter_output, call_sort_element_counts): no need to reset
+ the converter stash anymore.
+
+ * tp/Texinfo/XS/convert/build_html_perl_state.c,
+ tp/Texinfo/XS/convert/call_html_perl_function.c,
+ tp/Texinfo/XS/main/call_perl_function.c,
+ tp/Texinfo/XS/main/build_perl_info.c: update for the change in
+ CONVERTER, change variable names.
+
+ * tp/Texinfo/XS/convert/call_conversion_perl.c
+ (call_converter_output): add a SvREFCNT_inc before the second Perl
+ function call in call_converter_output.
+
+ * tp/Texinfo/XS/convert/converter.c (free_generic_converter):
+ unregister converter Perl object.
+
2025-01-19 Gavin Smith <gavinsmith0123@gmail.com>
* grand-replace.sh: split call to find/perl into function
diff --git a/tp/Texinfo/XS/convert/ConvertXS.xs
b/tp/Texinfo/XS/convert/ConvertXS.xs
index 9f53b0a372..7a89d03172 100644
--- a/tp/Texinfo/XS/convert/ConvertXS.xs
+++ b/tp/Texinfo/XS/convert/ConvertXS.xs
@@ -184,12 +184,12 @@ generic_converter_init (SV *converter_in, SV
*format_defaults_sv, SV *conf_sv=0)
self = get_or_create_sv_converter (converter_in, class_name);
converter_hv = (HV *)SvRV (converter_in);
- self->hv = converter_hv;
+ self->sv = converter_in;
/* hold a reference to the converter as long as we could access
it, in case there is nothing else holding a reference, for
instance when the converter is created by a call to Perl
method from C */
- SvREFCNT_inc ((SV *) self->hv);
+ SvREFCNT_inc ((SV *) self->sv);
format_defaults = get_converter_info_from_sv (format_defaults_sv,
class_name, self);
diff --git a/tp/Texinfo/XS/convert/build_html_perl_state.c
b/tp/Texinfo/XS/convert/build_html_perl_state.c
index 0489b856cf..6d337005d0 100644
--- a/tp/Texinfo/XS/convert/build_html_perl_state.c
+++ b/tp/Texinfo/XS/convert/build_html_perl_state.c
@@ -162,7 +162,7 @@ build_html_translated_names (HV *hv, CONVERTER *converter)
void
build_html_formatting_state (CONVERTER *converter)
{
- HV *hv;
+ HV *converter_hv;
unsigned long flags;
dTHX;
@@ -172,16 +172,16 @@ build_html_formatting_state (CONVERTER *converter)
if (!flags)
return;
- if (converter->external_references_number <= 0 || !converter->hv)
+ if (converter->external_references_number <= 0 || !converter->sv)
{
converter->modified_state = 0;
return;
}
- hv = converter->hv;
+ converter_hv = (HV *) SvRV ((SV *) converter->sv);
-#define STORE(key, value) hv_store (hv, key, strlen (key), value, 0)
+#define STORE(key, value) hv_store (converter_hv, key, strlen (key), value, 0)
if (flags & HMSF_current_root)
{
@@ -204,7 +204,7 @@ build_html_formatting_state (CONVERTER *converter)
#undef STORE
if (flags & HMSF_translations)
- build_html_translated_names (hv, converter);
+ build_html_translated_names (converter_hv, converter);
converter->modified_state = 0;
}
diff --git a/tp/Texinfo/XS/convert/call_conversion_perl.c
b/tp/Texinfo/XS/convert/call_conversion_perl.c
index 378256abe4..d0a8dc1f9c 100644
--- a/tp/Texinfo/XS/convert/call_conversion_perl.c
+++ b/tp/Texinfo/XS/convert/call_conversion_perl.c
@@ -202,8 +202,8 @@ call_convert_converter (const char *module_name,
/* call converter->output and converter->output_files_information if needed
and return an OUTPUT_TEXT_FILES_INFO which contains both the resulting text
and the output files information, if not already in the converter. */
-/* FIXME it would probably be better to be able to keep the converter
- SV to keep the blessing information instead of needing the module name */
+/* FIXME remove module_name argument? Or check that it matches the converter?
+ */
OUTPUT_TEXT_FILES_INFO *
call_converter_output (const char *module_name, CONVERTER *self,
DOCUMENT *document)
@@ -215,19 +215,15 @@ call_converter_output (const char *module_name, CONVERTER
*self,
const char *result_ret;
STRLEN len;
SV *result_sv;
- HV *hv_stash;
dTHX;
document_sv = get_document (document->descriptor);
SvREFCNT_inc (document_sv);
- converter_sv = newRV_inc (self->hv);
+ converter_sv = (SV *) self->sv;
SvREFCNT_inc (converter_sv);
- hv_stash = gv_stashpv (module_name, 0);
- sv_bless (converter_sv, hv_stash);
-
result = (OUTPUT_TEXT_FILES_INFO *)
non_perl_malloc (sizeof (OUTPUT_TEXT_FILES_INFO));
@@ -267,6 +263,8 @@ call_converter_output (const char *module_name, CONVERTER
*self,
|| self->output_files_information.unclosed_files.number > 0)
return result;
+ SvREFCNT_inc (converter_sv);
+
ENTER;
SAVETMPS;
@@ -295,8 +293,8 @@ call_converter_output (const char *module_name, CONVERTER
*self,
return result;
}
-/* FIXME it would probably be better to be able to keep the converter
- SV to keep the blessing information instead of needing the module name */
+/* FIXME remove module_name argument? Or check that it matches the converter?
+ */
char *
call_sort_element_counts (const char *module_name, CONVERTER *self,
DOCUMENT *document, int use_sections,
@@ -309,19 +307,15 @@ call_sort_element_counts (const char *module_name,
CONVERTER *self,
char *result;
STRLEN len;
SV *result_sv;
- HV *hv_stash;
dTHX;
document_sv = get_document (document->descriptor);
SvREFCNT_inc (document_sv);
- converter_sv = newRV_inc (self->hv);
+ converter_sv = (SV *) self->sv;
SvREFCNT_inc (converter_sv);
- hv_stash = gv_stashpv (module_name, 0);
- sv_bless (converter_sv, hv_stash);
-
dSP;
ENTER;
diff --git a/tp/Texinfo/XS/convert/call_html_perl_function.c
b/tp/Texinfo/XS/convert/call_html_perl_function.c
index 033082cd68..243c46b71b 100644
--- a/tp/Texinfo/XS/convert/call_html_perl_function.c
+++ b/tp/Texinfo/XS/convert/call_html_perl_function.c
@@ -85,7 +85,7 @@ call_file_id_setting_special_unit_target_file_name (CONVERTER
*self,
PUSHMARK(SP);
EXTEND(SP, 4);
- PUSHs(sv_2mortal (newRV_inc (self->hv)));
+ PUSHs(sv_2mortal (SvREFCNT_inc ((SV *) self->sv)));
PUSHs(sv_2mortal (newRV_inc (special_unit->hv)));
PUSHs(sv_2mortal (newSVpv_utf8 (target, 0)));
PUSHs(sv_2mortal (newSVpv_utf8 (default_filename, 0)));
@@ -158,7 +158,7 @@ call_file_id_setting_label_target_name (CONVERTER *self,
PUSHMARK(SP);
EXTEND(SP, 4);
- PUSHs(sv_2mortal (newRV_inc (self->hv)));
+ PUSHs(sv_2mortal (SvREFCNT_inc ((SV *) self->sv)));
PUSHs(sv_2mortal (newSVpv (normalized, 0)));
PUSHs(sv_2mortal (label_element_sv));
PUSHs(sv_2mortal (newSVpv (target, 0)));
@@ -215,7 +215,7 @@ call_file_id_setting_node_file_name (CONVERTER *self,
PUSHMARK(SP);
EXTEND(SP, 3);
- PUSHs(sv_2mortal (newRV_inc (self->hv)));
+ PUSHs(sv_2mortal (SvREFCNT_inc ((SV *) self->sv)));
PUSHs(sv_2mortal (newRV_inc (target_element->hv)));
PUSHs(sv_2mortal (newSVpv_utf8 (node_filename, 0)));
PUTBACK;
@@ -284,7 +284,7 @@ call_file_id_setting_sectioning_command_target_name
(CONVERTER *self,
PUSHMARK(SP);
EXTEND(SP, 6);
- PUSHs(sv_2mortal (newRV_inc (self->hv)));
+ PUSHs(sv_2mortal (SvREFCNT_inc ((SV *) self->sv)));
PUSHs(sv_2mortal (newRV_inc (command->hv)));
PUSHs(sv_2mortal (newSVpv (target, 0)));
PUSHs(sv_2mortal (newSVpv (target_contents, 0)));
@@ -351,7 +351,7 @@ call_file_id_setting_unit_file_name (CONVERTER *self,
PUSHMARK(SP);
EXTEND(SP, 4);
- PUSHs(sv_2mortal (newRV_inc (self->hv)));
+ PUSHs(sv_2mortal (SvREFCNT_inc ((SV *) self->sv)));
PUSHs(sv_2mortal (newRV_inc (output_unit->hv)));
PUSHs(sv_2mortal (newSVpv_utf8 (filename, 0)));
PUSHs(sv_2mortal (newSVpv_utf8 (filepath, 0)));
@@ -419,7 +419,7 @@ call_file_id_setting_external_target_split_name (CONVERTER
*self,
PUSHMARK(SP);
EXTEND(SP, 6);
- PUSHs(sv_2mortal (newRV_inc (self->hv)));
+ PUSHs(sv_2mortal (SvREFCNT_inc ((SV *) self->sv)));
PUSHs(sv_2mortal (newSVpv (normalized, 0)));
PUSHs(sv_2mortal (newRV_inc (element->hv)));
PUSHs(sv_2mortal (newSVpv (target, 0)));
@@ -501,7 +501,7 @@ call_file_id_setting_external_target_non_split_name
(CONVERTER *self,
PUSHMARK(SP);
EXTEND(SP, 5);
- PUSHs(sv_2mortal (newRV_inc (self->hv)));
+ PUSHs(sv_2mortal (SvREFCNT_inc ((SV *) self->sv)));
PUSHs(sv_2mortal (newSVpv (normalized, 0)));
PUSHs(sv_2mortal (newRV_inc (element->hv)));
PUSHs(sv_2mortal (newSVpv (target, 0)));
@@ -570,7 +570,7 @@ call_formatting_function_format_comment (CONVERTER *self,
PUSHMARK(SP);
EXTEND(SP, 2);
- PUSHs(sv_2mortal (newRV_inc (self->hv)));
+ PUSHs(sv_2mortal (SvREFCNT_inc ((SV *) self->sv)));
PUSHs(sv_2mortal (newSVpv_utf8 (text, 0)));
PUTBACK;
@@ -619,7 +619,7 @@ call_formatting_function_format_program_string (CONVERTER
*self,
PUSHMARK(SP);
EXTEND(SP, 1);
- PUSHs(sv_2mortal (newRV_inc (self->hv)));
+ PUSHs(sv_2mortal (SvREFCNT_inc ((SV *) self->sv)));
PUTBACK;
count = call_sv (formatting_reference_sv,
@@ -667,7 +667,7 @@ call_formatting_function_format_titlepage (CONVERTER *self,
PUSHMARK(SP);
EXTEND(SP, 1);
- PUSHs(sv_2mortal (newRV_inc (self->hv)));
+ PUSHs(sv_2mortal (SvREFCNT_inc ((SV *) self->sv)));
PUTBACK;
count = call_sv (formatting_reference_sv,
@@ -715,7 +715,7 @@ call_formatting_function_format_title_titlepage (CONVERTER
*self,
PUSHMARK(SP);
EXTEND(SP, 1);
- PUSHs(sv_2mortal (newRV_inc (self->hv)));
+ PUSHs(sv_2mortal (SvREFCNT_inc ((SV *) self->sv)));
PUTBACK;
count = call_sv (formatting_reference_sv,
@@ -764,7 +764,7 @@ call_formatting_function_format_protect_text (CONVERTER
*self,
PUSHMARK(SP);
EXTEND(SP, 2);
- PUSHs(sv_2mortal (newRV_inc (self->hv)));
+ PUSHs(sv_2mortal (SvREFCNT_inc ((SV *) self->sv)));
PUSHs(sv_2mortal (newSVpv_utf8 (text, 0)));
PUTBACK;
@@ -813,7 +813,7 @@ call_formatting_function_format_footnotes_segment
(CONVERTER *self,
PUSHMARK(SP);
EXTEND(SP, 1);
- PUSHs(sv_2mortal (newRV_inc (self->hv)));
+ PUSHs(sv_2mortal (SvREFCNT_inc ((SV *) self->sv)));
PUTBACK;
count = call_sv (formatting_reference_sv,
@@ -864,7 +864,7 @@ call_formatting_function_format_single_footnote (CONVERTER
*self,
PUSHMARK(SP);
EXTEND(SP, 1);
- PUSHs(sv_2mortal (newRV_inc (self->hv)));
+ PUSHs(sv_2mortal (SvREFCNT_inc ((SV *) self->sv)));
PUSHs(sv_2mortal (newRV_inc (element->hv)));
PUSHs(sv_2mortal (newSVpv_utf8 (footid, 0)));
PUSHs(sv_2mortal (newSViv ((IV) number_in_doc)));
@@ -917,7 +917,7 @@ call_formatting_function_format_footnotes_sequence
(CONVERTER *self,
PUSHMARK(SP);
EXTEND(SP, 1);
- PUSHs(sv_2mortal (newRV_inc (self->hv)));
+ PUSHs(sv_2mortal (SvREFCNT_inc ((SV *) self->sv)));
PUTBACK;
count = call_sv (formatting_reference_sv,
@@ -966,7 +966,7 @@ call_formatting_function_format_css_lines (CONVERTER *self,
PUSHMARK(SP);
EXTEND(SP, 2);
- PUSHs(sv_2mortal (newRV_inc (self->hv)));
+ PUSHs(sv_2mortal (SvREFCNT_inc ((SV *) self->sv)));
PUSHs(sv_2mortal (newSVpv_utf8 (filename, 0)));
PUTBACK;
@@ -1022,7 +1022,7 @@ call_formatting_function_format_end_file (CONVERTER *self,
PUSHMARK(SP);
EXTEND(SP, 3);
- PUSHs(sv_2mortal (newRV_inc (self->hv)));
+ PUSHs(sv_2mortal (SvREFCNT_inc ((SV *) self->sv)));
PUSHs(sv_2mortal (newSVpv_utf8 (filename, 0)));
PUSHs(sv_2mortal (output_unit_sv));
PUTBACK;
@@ -1080,7 +1080,7 @@ call_formatting_function_format_begin_file (CONVERTER
*self,
PUSHMARK(SP);
EXTEND(SP, 3);
- PUSHs(sv_2mortal (newRV_inc (self->hv)));
+ PUSHs(sv_2mortal (SvREFCNT_inc ((SV *) self->sv)));
PUSHs(sv_2mortal (newSVpv_utf8 (filename, 0)));
PUSHs(sv_2mortal (output_unit_sv));
PUTBACK;
@@ -1132,7 +1132,7 @@ call_formatting_function_format_translate_message
(CONVERTER *self,
PUSHMARK(SP);
EXTEND(SP, 4);
- PUSHs(sv_2mortal (newRV_inc (self->hv)));
+ PUSHs(sv_2mortal (SvREFCNT_inc ((SV *) self->sv)));
PUSHs(sv_2mortal (newSVpv_utf8 (message, 0)));
PUSHs(sv_2mortal (newSVpv (lang, 0)));
PUSHs(sv_2mortal (newSVpv_utf8 (message_context, 0)));
@@ -1197,7 +1197,7 @@ call_formatting_function_format_button_icon_img
(CONVERTER *self,
PUSHMARK(SP);
EXTEND(SP, 4);
- PUSHs(sv_2mortal (newRV_inc (self->hv)));
+ PUSHs(sv_2mortal (SvREFCNT_inc ((SV *) self->sv)));
PUSHs(sv_2mortal (newSVpv_utf8 (button_name, 0)));
PUSHs(sv_2mortal (newSVpv_utf8 (icon, 0)));
PUSHs(sv_2mortal (name_sv));
@@ -1255,7 +1255,7 @@ call_formatting_function_format_button (CONVERTER *self,
SvREFCNT_inc (button->sv);
- PUSHs(sv_2mortal (newRV_inc (self->hv)));
+ PUSHs(sv_2mortal (SvREFCNT_inc ((SV *) self->sv)));
PUSHs(sv_2mortal (button->sv));
PUSHs(sv_2mortal (newRV_inc (element->hv)));
PUTBACK;
@@ -1331,7 +1331,7 @@ call_formatting_function_format_navigation_panel
(CONVERTER *self,
PUSHMARK(SP);
EXTEND(SP, 5);
- PUSHs(sv_2mortal (newRV_inc (self->hv)));
+ PUSHs(sv_2mortal (SvREFCNT_inc ((SV *) self->sv)));
PUSHs(sv_2mortal (newRV_inc (buttons->av)));
PUSHs(sv_2mortal (newSVpv (cmdname, 0)));
PUSHs(sv_2mortal (newRV_inc (element->hv)));
@@ -1391,7 +1391,7 @@ call_formatting_function_format_navigation_header
(CONVERTER *self,
PUSHMARK(SP);
EXTEND(SP, 4);
- PUSHs(sv_2mortal (newRV_inc (self->hv)));
+ PUSHs(sv_2mortal (SvREFCNT_inc ((SV *) self->sv)));
PUSHs(sv_2mortal (newRV_inc (buttons->av)));
PUSHs(sv_2mortal (newSVpv (cmdname, 0)));
PUSHs(sv_2mortal (newRV_inc (element->hv)));
@@ -1471,7 +1471,7 @@ call_formatting_function_format_heading_text (CONVERTER
*self,
PUSHMARK(SP);
EXTEND(SP, 7);
- PUSHs(sv_2mortal (newRV_inc (self->hv)));
+ PUSHs(sv_2mortal (SvREFCNT_inc ((SV *) self->sv)));
PUSHs(sv_2mortal (newSVpv (cmdname, 0)));
PUSHs(sv_2mortal (classes_sv));
PUSHs(sv_2mortal (newSVpv_utf8 (text, 0)));
@@ -1536,7 +1536,7 @@ call_formatting_function_format_contents (CONVERTER *self,
PUSHMARK(SP);
EXTEND(SP, 4);
- PUSHs(sv_2mortal (newRV_inc (self->hv)));
+ PUSHs(sv_2mortal (SvREFCNT_inc ((SV *) self->sv)));
PUSHs(sv_2mortal (newSVpv (cmdname, 0)));
PUSHs(sv_2mortal (command_sv));
PUSHs(sv_2mortal (newSVpv_utf8 (filename, 0)));
@@ -1590,7 +1590,7 @@ call_formatting_function_format_separate_anchor
(CONVERTER *self,
PUSHMARK(SP);
EXTEND(SP, 4);
- PUSHs(sv_2mortal (newRV_inc (self->hv)));
+ PUSHs(sv_2mortal (SvREFCNT_inc ((SV *) self->sv)));
PUSHs(sv_2mortal (newSVpv_utf8 (id, 0)));
PUSHs(sv_2mortal (newSVpv_utf8 (class, 0)));
PUTBACK;
@@ -1644,7 +1644,7 @@ call_formatting_function_format_element_header (CONVERTER
*self,
PUSHMARK(SP);
EXTEND(SP, 4);
- PUSHs(sv_2mortal (newRV_inc (self->hv)));
+ PUSHs(sv_2mortal (SvREFCNT_inc ((SV *) self->sv)));
PUSHs(sv_2mortal (newSVpv (cmdname, 0)));
PUSHs(sv_2mortal (newRV_inc (command->hv)));
PUSHs(sv_2mortal (newRV_inc (output_unit->hv)));
@@ -1700,7 +1700,7 @@ call_formatting_function_format_element_footer (CONVERTER
*self,
PUSHMARK(SP);
EXTEND(SP, 5);
- PUSHs(sv_2mortal (newRV_inc (self->hv)));
+ PUSHs(sv_2mortal (SvREFCNT_inc ((SV *) self->sv)));
PUSHs(sv_2mortal (newSVpv (output_unit_type_names[unit_type], 0)));
PUSHs(sv_2mortal (newRV_inc (output_unit->hv)));
/* content == 0 is possible, hope that newSVpv result corresponds to
@@ -1757,7 +1757,7 @@ call_formatting_function_format_node_redirection_page
(CONVERTER *self,
PUSHMARK(SP);
EXTEND(SP, 3);
- PUSHs(sv_2mortal (newRV_inc (self->hv)));
+ PUSHs(sv_2mortal (SvREFCNT_inc ((SV *) self->sv)));
PUSHs(sv_2mortal (newRV_inc (command->hv)));
PUSHs(sv_2mortal (newSVpv_utf8 (filename, 0)));
PUTBACK;
@@ -1820,7 +1820,7 @@ call_types_conversion (CONVERTER *self, const enum
element_type type,
PUSHMARK(SP);
EXTEND(SP, 4);
- PUSHs(sv_2mortal (newRV_inc (self->hv)));
+ PUSHs(sv_2mortal (SvREFCNT_inc ((SV *) self->sv)));
PUSHs(sv_2mortal (newSVpv (type_data[type].name, 0)));
PUSHs(sv_2mortal (newRV_inc (element->hv)));
/* content == 0 is possible, hope that newSVpv result corresponds to
@@ -1875,7 +1875,7 @@ call_types_open (CONVERTER *self, const enum element_type
type,
PUSHMARK(SP);
EXTEND(SP, 3);
- PUSHs(sv_2mortal (newRV_inc (self->hv)));
+ PUSHs(sv_2mortal (SvREFCNT_inc ((SV *) self->sv)));
PUSHs(sv_2mortal (newSVpv (type_data[type].name, 0)));
PUSHs(sv_2mortal (newRV_inc (element->hv)));
PUTBACK;
@@ -1990,7 +1990,7 @@ call_commands_conversion (CONVERTER *self, const enum
command_id cmd,
PUSHMARK(SP);
EXTEND(SP, 5);
- PUSHs(sv_2mortal (newRV_inc (self->hv)));
+ PUSHs(sv_2mortal (SvREFCNT_inc ((SV *) self->sv)));
PUSHs(sv_2mortal (newSVpv (command_name, 0)));
PUSHs(sv_2mortal (newRV_inc (element->hv)));
PUSHs(sv_2mortal (args_formatted_sv));
@@ -2054,7 +2054,7 @@ call_commands_open (CONVERTER *self, const enum
command_id cmd,
PUSHMARK(SP);
EXTEND(SP, 3);
- PUSHs(sv_2mortal (newRV_inc (self->hv)));
+ PUSHs(sv_2mortal (SvREFCNT_inc ((SV *) self->sv)));
PUSHs(sv_2mortal (newSVpv (command_name, 0)));
PUSHs(sv_2mortal (newRV_inc (element->hv)));
PUTBACK;
@@ -2109,7 +2109,7 @@ call_output_units_conversion (CONVERTER *self,
PUSHMARK(SP);
EXTEND(SP, 4);
- PUSHs(sv_2mortal (newRV_inc (self->hv)));
+ PUSHs(sv_2mortal (SvREFCNT_inc ((SV *) self->sv)));
PUSHs(sv_2mortal (newSVpv (output_unit_type_names[unit_type], 0)));
PUSHs(sv_2mortal (newRV_inc (output_unit->hv)));
/* content == 0 is possible, hope that newSVpv result corresponds to
@@ -2169,7 +2169,7 @@ call_special_unit_body_formatting (CONVERTER *self,
PUSHMARK(SP);
EXTEND(SP, 4);
- PUSHs(sv_2mortal (newRV_inc (self->hv)));
+ PUSHs(sv_2mortal (SvREFCNT_inc ((SV *) self->sv)));
PUSHs(sv_2mortal (newSVpv (special_unit_variety, 0)));
PUSHs(sv_2mortal (newRV_inc (output_unit->hv)));
PUTBACK;
@@ -2223,7 +2223,7 @@ call_button_simple_function (CONVERTER *self,
PUSHMARK(SP);
EXTEND(SP, 1);
- PUSHs(sv_2mortal (newRV_inc (self->hv)));
+ PUSHs(sv_2mortal (SvREFCNT_inc ((SV *) self->sv)));
PUTBACK;
count = call_sv ((SV *) formatting_reference_sv,
@@ -2282,7 +2282,7 @@ call_button_direction_function (CONVERTER *self,
PUSHMARK(SP);
EXTEND(SP, 3);
- PUSHs(sv_2mortal (newRV_inc (self->hv)));
+ PUSHs(sv_2mortal (SvREFCNT_inc ((SV *) self->sv)));
PUSHs(sv_2mortal (newSVpv (self->main_units_direction_names[direction],
0)));
PUSHs(sv_2mortal (newRV_inc (element->hv)));
@@ -2333,17 +2333,20 @@ call_latex_convert_to_latex_math (CONVERTER *self,
const ELEMENT *element)
SV *result_sv;
SV **options_latex_math_sv;
SV *options_latex_math;
+ HV *converter_hv;
dTHX;
- if (!self->hv)
+ if (!self->sv)
return 0;
build_tree_to_build (&self->tree_to_build);
dSP;
- options_latex_math_sv = hv_fetch (self->hv, "options_latex_math",
+ converter_hv = (HV *) SvRV ((SV *) self->sv);
+
+ options_latex_math_sv = hv_fetch (converter_hv, "options_latex_math",
strlen ("options_latex_math"), 0);
if (options_latex_math_sv)
@@ -2355,7 +2358,8 @@ call_latex_convert_to_latex_math (CONVERTER *self, const
ELEMENT *element)
{
/* NOTE this case should never happen. If it does, we could set the
options here dynamically */
- fprintf (stderr, "BUG: no options_latex_math in %p\n", self->hv);
+ fprintf (stderr, "BUG: no options_latex_math in %p %p\n",
+ converter_hv, self->sv);
options_latex_math = newSV (0);
}
@@ -2406,7 +2410,8 @@ call_stage_handler (CONVERTER *self, void
*stage_handler_sv,
if (self->document)
{
- SV **document_ref_sv = hv_fetch (self->hv, "document",
+ HV *converter_hv = (HV *) SvRV ((SV *) self->sv);
+ SV **document_ref_sv = hv_fetch (converter_hv, "document",
strlen ("document"), 0);
if (document_ref_sv && *document_ref_sv)
{
@@ -2426,7 +2431,7 @@ call_stage_handler (CONVERTER *self, void
*stage_handler_sv,
PUSHMARK(SP);
EXTEND(SP, 3);
- PUSHs(sv_2mortal (newRV_inc (self->hv)));
+ PUSHs(sv_2mortal (SvREFCNT_inc ((SV *) self->sv)));
PUSHs(sv_2mortal (document_sv));
PUSHs(sv_2mortal (newSVpv (stage_name, 0)));
diff --git a/tp/Texinfo/XS/convert/converter.c
b/tp/Texinfo/XS/convert/converter.c
index b2fc5309da..5632044115 100644
--- a/tp/Texinfo/XS/convert/converter.c
+++ b/tp/Texinfo/XS/convert/converter.c
@@ -2022,8 +2022,8 @@ free_generic_converter (CONVERTER *self)
free_strings_list (&self->small_strings);
- if (self->hv)
- register_perl_data (self->hv);
+ if (self->sv)
+ unregister_perl_data (self->sv);
}
void
diff --git a/tp/Texinfo/XS/main/build_perl_info.c
b/tp/Texinfo/XS/main/build_perl_info.c
index 2a61dc5b42..6db16a0b03 100644
--- a/tp/Texinfo/XS/main/build_perl_info.c
+++ b/tp/Texinfo/XS/main/build_perl_info.c
@@ -2779,9 +2779,10 @@ build_convert_text_options (TEXT_OPTIONS *text_options)
STORE("INCLUDE_DIRECTORIES", newRV_noinc ((SV *) av));
}
- if (text_options->converter && text_options->converter->hv)
+ if (text_options->converter && text_options->converter->sv)
{
- STORE("converter", newRV_inc ((SV *) text_options->converter->hv));
+ SvREFCNT_inc (text_options->converter->sv);
+ STORE("converter", text_options->converter->sv);
}
#undef STORE
diff --git a/tp/Texinfo/XS/main/call_perl_function.c
b/tp/Texinfo/XS/main/call_perl_function.c
index c5337d6d6b..079891e7a8 100644
--- a/tp/Texinfo/XS/main/call_perl_function.c
+++ b/tp/Texinfo/XS/main/call_perl_function.c
@@ -73,7 +73,7 @@ call_common_set_output_perl_encoding (const CONVERTER *self)
PUSHMARK(SP);
EXTEND(SP, 1);
- PUSHs(sv_2mortal (newRV_inc (self->hv)));
+ PUSHs(sv_2mortal (SvREFCNT_inc ((SV *) self->sv)));
PUTBACK;
count = call_pv (
diff --git a/tp/Texinfo/XS/main/converter_types.h
b/tp/Texinfo/XS/main/converter_types.h
index 6d69e953c2..4b3d412a03 100644
--- a/tp/Texinfo/XS/main/converter_types.h
+++ b/tp/Texinfo/XS/main/converter_types.h
@@ -793,9 +793,9 @@ typedef struct CONVERTER_INITIALIZATION_INFO {
typedef struct CONVERTER {
int converter_descriptor;
- /* perl converter. This should be HV *hv,
+ /* perl converter. This should be SV *sv,
but we don't want to include the Perl headers everywhere; */
- void *hv;
+ void *sv;
/* this is the type of the converter, not of the output. (Similar to
a module name in Perl). Should only be used to determine which