Subject: | [PATCH] Pad changes in 5.17.4-to-be |
This module no longer works with bleadperl. Attached is a patch, which also adds SvPADMY_on,
for debugging builds. For more information, see:
http://perl5.git.perl.org/perl.git/commitdiff/86b9d2936
http://perl5.git.perl.org/perl.git/commitdiff/35e035ccb
http://perl5.git.perl.org/perl.git/commitdiff/86d2498c0
Subject: | open_z7QAUyJk.txt |
diff -rup fields-aliased-1.05-3Ais34/aliased.xs fields-aliased-1.05-fmbuAM/aliased.xs
--- fields-aliased-1.05-3Ais34/aliased.xs 2004-10-16 23:21:00.000000000 -0700
+++ fields-aliased-1.05-fmbuAM/aliased.xs 2012-08-29 00:00:58.000000000 -0700
@@ -2,6 +2,21 @@
#include "perl.h"
#include "XSUB.h"
+#ifndef PadARRAY
+typedef AV PADNAMELIST;
+typedef SV PADNAME;
+# if PERL_VERSION < 8 || (PERL_VERSION == 8 && !PERL_SUBVERSION)
+typedef AV PAD;
+# endif
+# define PadlistARRAY(pl) ((PAD **)AvARRAY(pl))
+# define PadlistNAMES(pl) (*PadlistARRAY(pl))
+# define PadnamelistARRAY(pnl) ((PADNAME **)AvARRAY(pnl))
+# define PadnamelistMAX(pnl) AvFILLp(pnl)
+# define PadARRAY AvARRAY
+# define PadnamePV(pn) (SvPOKp(pn) ? SvPVX(pn) : NULL)
+# define PadnameSV(pn) pn
+#endif
+
#define MAX_VARNAME_LENGTH 254
/*
@@ -194,7 +209,8 @@ setup(SV *self, SV *packname, ...)
SV *selfref;
HV *pshindex;
I32 selftype;
- AV *padv, *padn;
+ PAD *padv;
+ PADNAMELIST *padn;
static const char fields[] = "::FIELDS";
CODE:
/******************************************************************
@@ -203,8 +219,8 @@ setup(SV *self, SV *packname, ...)
{
U32 dummy;
CV *cv = find_runcv(aTHX_ &dummy);
- padv = (AV *)AvARRAY(CvPADLIST(cv))[CvDEPTH(cv)];
- padn = (AV *)AvARRAY(CvPADLIST(cv))[0];
+ padv = PadlistARRAY(CvPADLIST(cv))[CvDEPTH(cv)];
+ padn = PadlistNAMES(CvPADLIST(cv));
}
/******************************************************************
@@ -273,16 +289,17 @@ setup(SV *self, SV *packname, ...)
* Go through the list of pad names. For each one that exists
* in the hash created above, create the appropriate alias.
*****************************************************************/
- for (i = 0; i <= av_len(padn); ++i) {
- SV **nameptr = av_fetch(padn, i, 0);
+ for (i = 0; i <= PadnamelistMAX(padn); ++i) {
+ PADNAME *pname = PadnamelistARRAY(padn)[i];
HE *hent;
SV **field;
+ const char *name;
- if (nameptr != NULL
- && SvPOKp(*nameptr)
- && (hent = hv_fetch_ent(arglist, *nameptr, 0, 0)) != NULL) {
+ if (pname != NULL
+ && (name = PadnamePV(pname))
+ && (hent = hv_fetch_ent(arglist, PadnameSV(pname),
+ 0, 0)) != NULL) {
SV *field = HeVAL(hent);
- const char *name = SvPV_nolen(*nameptr);
SV *new_sv;
SV *val;
SV *(*deflt)();
@@ -341,8 +358,10 @@ setup(SV *self, SV *packname, ...)
* new_sv represents the aliased value.
* Store it into the pad slot.
*******************************************************/
- av_store(padv, i, new_sv);
+ SvREFCNT_dec(PadARRAY(padv)[i]);
+ PadARRAY(padv)[i] = new_sv;
SvREFCNT_inc(new_sv);
+ SvPADMY_on(new_sv);
}
}
SvREFCNT_dec((SV*)arglist);