summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYves Orton <demerphq@gmail.com>2023-03-04 09:00:37 +0100
committerVincent Pit <vpit@cpan.org>2023-03-26 14:56:05 +0200
commitc8fb3ada01d8c1a6ac1a37778edb0fc9164d7bf1 (patch)
tree19a1ddef5546c968faf67943feb96453ffa7e2b5
parentef4ac48db70f6d8dcaa21e6b67e7fbec7a50cf7b (diff)
Upper.xs - in 5.37.6 cop_warnings became a char * (RCVP)
It is actually a RCPV (RefCounted PV), so we can use RCPV_LEN() to find its length. Unfortunately there is not currently a way to "mortalize" a RCPV, an oversight that I will correct in a future release of Perl. But for now this should do.
-rw-r--r--Upper.xs8
1 files changed, 6 insertions, 2 deletions
diff --git a/Upper.xs b/Upper.xs
index 0c762de..7d994fc 100644
--- a/Upper.xs
+++ b/Upper.xs
@@ -3136,7 +3136,9 @@ PPCODE:
/* warnings (9) */
{
SV *mask = NULL;
-#if XSH_HAS_PERL(5, 9, 4)
+#if XSH_HAS_PERL(5, 37, 6)
+ char *old_warnings = cop->cop_warnings;
+#elif XSH_HAS_PERL(5, 9, 4)
STRLEN *old_warnings = cop->cop_warnings;
#else
SV *old_warnings = cop->cop_warnings;
@@ -3169,7 +3171,9 @@ context_info_warnings_on:
if (!mask)
mask = su_newmortal_pvn(WARN_ALLstring, WARNsize);
} else {
-#if XSH_HAS_PERL(5, 9, 4)
+#if XSH_HAS_PERL(5, 37, 6)
+ mask = su_newmortal_pvn((char *) old_warnings, RCPV_LEN(old_warnings));
+#elif XSH_HAS_PERL(5, 9, 4)
mask = su_newmortal_pvn((char *) (old_warnings + 1), old_warnings[0]);
#else
mask = sv_mortalcopy(old_warnings);