[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/XS/main/build_perl_info.c (build_htm
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/XS/main/build_perl_info.c (build_html_formatting_state): current_filename is found by get_info, therefore in converter_info there is a reference on the value in the converter hash. The associated SV should not be replaced such that its reference stays the same. Therefore for current_filename use sv_setpv to modify the value but not the SV to pass to perl. |
Date: |
Fri, 03 Nov 2023 11:01:32 -0400 |
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 a865a49b2d * tp/Texinfo/XS/main/build_perl_info.c
(build_html_formatting_state): current_filename is found by get_info, therefore
in converter_info there is a reference on the value in the converter hash. The
associated SV should not be replaced such that its reference stays the same.
Therefore for current_filename use sv_setpv to modify the value but not the SV
to pass to perl.
a865a49b2d is described below
commit a865a49b2da17ae713e91dfea31f0bbd956874b4
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Fri Nov 3 16:01:18 2023 +0100
* tp/Texinfo/XS/main/build_perl_info.c (build_html_formatting_state):
current_filename is found by get_info, therefore in converter_info
there is a reference on the value in the converter hash. The
associated SV should not be replaced such that its reference stays the
same. Therefore for current_filename use sv_setpv to modify the
value but not the SV to pass to perl.
---
ChangeLog | 9 +++++++++
tp/Texinfo/Convert/HTML.pm | 2 ++
tp/Texinfo/XS/main/build_perl_info.c | 19 ++++++++++++++-----
3 files changed, 25 insertions(+), 5 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index e85bd33e33..1faee5d299 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2023-11-03 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/XS/main/build_perl_info.c (build_html_formatting_state):
+ current_filename is found by get_info, therefore in converter_info
+ there is a reference on the value in the converter hash. The
+ associated SV should not be replaced such that its reference stays the
+ same. Therefore for current_filename use sv_setpv to modify the
+ value but not the SV to pass to perl.
+
2023-11-03 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/XS/convert/convert_html.c (command_special_unit_variety)
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index 99a3075a1f..947ec95e2b 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -11609,6 +11609,8 @@ sub output($$)
my $root = $document->tree();
+ # set here early even though actual values are only set later on. It is
+ # therefore set in converter_info early too (using the reference).
$self->{'current_filename'} = undef;
$self->_initialize_output_state();
diff --git a/tp/Texinfo/XS/main/build_perl_info.c
b/tp/Texinfo/XS/main/build_perl_info.c
index bee8c65ea9..351408c716 100644
--- a/tp/Texinfo/XS/main/build_perl_info.c
+++ b/tp/Texinfo/XS/main/build_perl_info.c
@@ -2245,6 +2245,7 @@ build_html_formatting_state (CONVERTER *converter,
unsigned long flags)
STORE("current_node",
newRV_inc ((SV *) converter->current_node->hv));
}
+
if (flags & HMSF_current_output_unit)
{
if (!converter->current_output_unit)
@@ -2253,13 +2254,21 @@ build_html_formatting_state (CONVERTER *converter,
unsigned long flags)
STORE("current_output_unit",
newRV_inc ((SV *) converter->current_output_unit->hv));
}
+
+ /* for scalars corresponding to value that can be found in get_info
+ the value associated to the key in the 'converter_info' hash is
+ a reference to the value in the converter, such as
+ \$converter->{"current_filename"}.
+ *current_filename_sv corresponds to $converter->{"current_filename"},
+ the value should be changed, but the SV should not be replaced */
if (flags & HMSF_current_filename)
{
- if (!converter->current_filename)
- STORE("current_filename", newSV (0));
- else
- STORE("current_filename",
- newSVpv_utf8 (converter->current_filename, 0));
+ SV **current_filename_sv;
+ current_filename_sv = hv_fetch (hv, "current_filename",
+ strlen ("current_filename"), 1);
+ sv_setpv (*current_filename_sv, converter->current_filename);
+ if (converter->current_filename)
+ SvUTF8_on (*current_filename_sv);
}
if (flags & HMSF_document_context)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/XS/main/build_perl_info.c (build_html_formatting_state): current_filename is found by get_info, therefore in converter_info there is a reference on the value in the converter hash. The associated SV should not be replaced such that its reference stays the same. Therefore for current_filename use sv_setpv to modify the value but not the SV to pass to perl.,
Patrice Dumas <=