Skip Menu |

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

Report information
The Basics
Id: 80366
Status: resolved
Priority: 0/
Queue: Sub-Mutate

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] Fix for 5.17.4
This is not completely future-proof, as it treats pads as AVs still, but I am honestly starting to run out of energy for this pad stuff. :-)
Subject: open_XqW1AweH.txt
diff -rup Sub-Mutate-0.004-YliM3H/lib/Sub/Mutate.xs Sub-Mutate-0.004-0McnN2/lib/Sub/Mutate.xs --- Sub-Mutate-0.004-YliM3H/lib/Sub/Mutate.xs 2011-10-27 14:21:48.000000000 -0700 +++ Sub-Mutate-0.004-0McnN2/lib/Sub/Mutate.xs 2012-10-23 20:40:52.000000000 -0700 @@ -55,6 +55,18 @@ static void THX_sv_unbless(pTHX_ SV *sv) (!sv_is_glob(sv) && !sv_is_regexp(sv) && \ (SvFLAGS(sv) & (SVf_IOK|SVf_NOK|SVf_POK|SVp_IOK|SVp_NOK|SVp_POK))) +#ifdef PadARRAY +# define NEWPADAPI +#else +typedef AV PADNAMELIST; +# if PERL_VERSION < 8 || (PERL_VERSION == 8 && !PERL_SUBVERSION) +typedef AV PADLIST; +typedef AV PAD; +# endif +# define PadlistARRAY(pl) ((PAD **)AvARRAY(pl)) +# define PadlistNAMES(pl) (*PadlistARRAY(pl)) +#endif + /* * when_sub_bodied() mechanism: * @@ -100,29 +112,35 @@ static SV *whenbodied_running; static HV *stash_whenbodied; #define new_minimal_padlist() THX_new_minimal_padlist(aTHX) -static AV *THX_new_minimal_padlist(pTHX) +static PADLIST *THX_new_minimal_padlist(pTHX) { - AV *padlist, *pad; + PADLIST *padlist; + PAD *pad; pad = newAV(); av_store(pad, 0, &PL_sv_undef); +#ifdef NEWPADAPI + Newxz(padlist, 1, PADLIST); + Newx(PadlistARRAY(padlist), 2, PAD *); +#else padlist = newAV(); AvREAL_off(padlist); av_extend(padlist, 1); - av_store(padlist, 0, (SV*)newAV()); - av_store(padlist, 1, (SV*)pad); +#endif + PadlistNAMES(padlist) = (PADNAMELIST *)newAV(); + PadlistARRAY(padlist)[1] = pad; return padlist; } #define cv_find_whenbodied(sub) THX_cv_find_whenbodied(aTHX_ sub) static AV *THX_cv_find_whenbodied(pTHX_ CV *sub) { - AV *padlist; + PADLIST *padlist; AV *argav; I32 pos; if(CvDEPTH(sub) != 0) return NULL; padlist = CvPADLIST(sub); if(!padlist) return NULL; - argav = (AV*)safe_av_fetch((AV*)*av_fetch(padlist, 1, 0), 0); + argav = (AV*)safe_av_fetch((AV*)PadlistARRAY(padlist)[1], 0); if(SvTYPE((SV*)argav) != SVt_PVAV) return NULL; for(pos = av_len(argav); pos >= 0; pos--) { SV *v = safe_av_fetch(argav, pos); @@ -136,12 +154,13 @@ static AV *THX_cv_find_whenbodied(pTHX_ #define cv_force_whenbodied(sub) THX_cv_force_whenbodied(aTHX_ sub) static AV *THX_cv_force_whenbodied(pTHX_ CV *sub) { - AV *padlist; - AV *pad, *argav, *wb; + PADLIST *padlist; + PAD *pad; + AV *argav, *wb; I32 pos; padlist = CvPADLIST(sub); if(!padlist) goto create_padlist; - pad = (AV*)*av_fetch(padlist, 1, 0); + pad = PadlistARRAY(padlist)[1]; argav = (AV*)safe_av_fetch(pad, 0); if(SvTYPE((SV*)argav) != SVt_PVAV) goto create_argav; for(pos = av_len(argav); pos >= 0; pos--) {
Subject: Re: [rt.cpan.org #80366] [PATCH] Fix for 5.17.4
Date: Thu, 1 Aug 2013 17:45:47 +0100
To: Father Chrysostomos via RT <bug-Sub-Mutate [...] rt.cpan.org>
From: Zefram <zefram [...] fysh.org>
At work I'm successfully using Sprout's patch. -zefram
Fixed in Sub-Mutate-0.005, now on CPAN.