]> git.vpit.fr Git - perl/modules/Scope-Upper.git/commitdiff
Upper.xs - in 5.37.6 cop_warnings became a char * (RCVP) rt146897
authorYves Orton <demerphq@gmail.com>
Sat, 4 Mar 2023 08:00:37 +0000 (09:00 +0100)
committerVincent Pit <vpit@cpan.org>
Sun, 26 Mar 2023 12:56:05 +0000 (14:56 +0200)
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.

Upper.xs

index 0c762de1dcb947d420bd265d01231d8cec433d7e..7d994fcdf5e83105e985ca71da13416ca6da1828 100644 (file)
--- 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);