From: Yves Orton Date: Sat, 4 Mar 2023 08:00:37 +0000 (+0100) Subject: Upper.xs - in 5.37.6 cop_warnings became a char * (RCVP) X-Git-Tag: rt146897^0 X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FScope-Upper.git;a=commitdiff_plain;h=c8fb3ada01d8c1a6ac1a37778edb0fc9164d7bf1 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. --- 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);