Skip Menu |

This queue is for tickets about the Sub-Clone CPAN distribution.

Report information
The Basics
Id: 79266
Status: new
Priority: 0/
Queue: Sub-Clone

People
Owner: Nobody in particular
Requestors: 'spro^^*%*^6ut# [...] &$%*c
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: [PATCH] Pad changes in 5.17.4-to-be
Subject: open_YdOKFLTE.txt
diff -rup Sub-Clone-0.03-BZrywZ/Clone.xs Sub-Clone-0.03-SwK9Gg/Clone.xs --- Sub-Clone-0.03-BZrywZ/Clone.xs 2008-09-14 08:43:55.000000000 -0700 +++ Sub-Clone-0.03-SwK9Gg/Clone.xs 2012-08-28 11:30:14.000000000 -0700 @@ -4,24 +4,40 @@ #define NEED_newRV_noinc #include "ppport.h" +#ifndef PadARRAY +typedef AV PADNAMELIST; +typedef SV PADNAME; +# if PERL_VERSION < 8 || (PERL_VERSION == 8 && !PERL_SUBVERSION) +typedef AV PADLIST; +typedef AV PAD; +# endif +# define PadlistARRAY(pl) ((PAD **)AvARRAY(pl)) +# define PadlistNAMESARRAY(pl) AvARRAY(*PadlistARRAY(pl)) +# define PadlistNAMESMAX(pl) AvFILLp(*PadlistARRAY(pl)) +# define PadARRAY AvARRAY +# define PadnameOUTER(pn) !!SvFAKE(pn) +# define PadnamePV(pn) (SvPOKp(pn) ? SvPVX(pn) : NULL) +#endif + STATIC SV * clone_sub (pTHX_ CV *proto) { CV *cv = Perl_cv_clone(aTHX_ proto); SV *clone = newRV_noinc((SV *)cv); - AV* const protopadlist = CvPADLIST(proto); - const AV* const protopad_name = (AV*)*av_fetch(protopadlist, 0, FALSE); - const AV* const protopad = (AV*)*av_fetch(protopadlist, 1, FALSE); - SV** const pname = AvARRAY(protopad_name); - SV** const ppad = AvARRAY(protopad); - const I32 fname = AvFILLp(protopad_name); - AV *new_pad = (AV *)*av_fetch(CvPADLIST(cv), 1, 0); + PADLIST* const protopadlist = CvPADLIST(proto); + const PAD* const protopad = PadlistARRAY(protopadlist)[1]; + PADNAME** const pname = PadlistNAMESARRAY(protopadlist); + SV** const ppad = PadARRAY(protopad); + const I32 fname = PadlistNAMESMAX(protopadlist); + PAD *new_pad = PadlistARRAY(CvPADLIST(cv))[1]; I32 ix; /* alias all the captured vars, they were recaptured by cv_clone */ for (ix = fname; ix > 0; ix--) { - SV* const namesv = pname[ix]; - if (namesv && namesv != &PL_sv_undef) { /* lexical */ - if (SvFAKE(namesv)) { /* lexical from outside? */ - av_store(new_pad, ix, SvREFCNT_inc(ppad[ix])); + PADNAME* const name = pname[ix]; + if (name && PadnamePV(name)) { /* lexical */ + if (PadnameOUTER(name)) { /*lexical from outside?*/ + SvREFCNT_dec(PadARRAY(new_pad)[ix]); + PadARRAY(new_pad)[ix] = + SvREFCNT_inc(ppad[ix]); } } }