From: Nicholas Clark Date: Fri, 24 Feb 2006 11:52:28 +0000 (+0000) Subject: Replace usage of GvSTASH for storing the stash of C with X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=035dab7448e2a9119f77775183b21181a53213a3;p=p5sagit%2Fp5-mst-13.2.git Replace usage of GvSTASH for storing the stash of C with OURSTASH. Set the stash with OURSTASH_SET. p4raw-id: //depot/perl@27306 --- diff --git a/pad.c b/pad.c index 880902d..97e2615 100644 --- a/pad.c +++ b/pad.c @@ -321,7 +321,7 @@ offset. If C is valid, the name is for a typed lexical; set the name's stash to that value. If C is valid, it's an our lexical, set the name's -GvSTASH to that value +OURSTASH to that value If fake, it means we're cloning an existing entry @@ -347,7 +347,7 @@ Perl_pad_add_name(pTHX_ const char *name, HV* typestash, HV* ourstash, bool fake } if (ourstash) { SvPAD_OUR_on(namesv); - GvSTASH(namesv) = ourstash; + OURSTASH_set(namesv, ourstash); Perl_sv_add_backref(aTHX_ (SV*)ourstash, namesv); } @@ -549,7 +549,7 @@ Perl_pad_check_dup(pTHX_ const char *name, bool is_our, const HV *ourstash) && sv != &PL_sv_undef && !SvFAKE(sv) && (SvIVX(sv) == PAD_MAX || SvIVX(sv) == 0) - && ((SvPAD_OUR(sv)) && GvSTASH(sv) == ourstash) + && OURSTASH(sv) == ourstash && strEQ(name, SvPVX_const(sv))) { Perl_warner(aTHX_ packWARN(WARN_MISC), @@ -838,8 +838,7 @@ S_pad_findlex(pTHX_ const char *name, const CV* cv, U32 seq, int warn, SvPVX_const(*out_name_sv), SvPAD_TYPED(*out_name_sv) ? SvSTASH(*out_name_sv) : NULL, - SvPAD_OUR(*out_name_sv) - ? GvSTASH(*out_name_sv) : NULL, + OURSTASH(*out_name_sv), 1 /* fake */ ); diff --git a/pad.h b/pad.h index b234e63..acfb58e 100644 --- a/pad.h +++ b/pad.h @@ -226,7 +226,7 @@ ling pad (lvalue) to C. Note that C is hijacked for this purpos #define PAD_COMPNAME_TYPE(po) pad_compname_type(po) #define PAD_COMPNAME_OURSTASH(po) \ - (GvSTASH(*av_fetch(PL_comppad_name, (po), FALSE))) + (OURSTASH(*av_fetch(PL_comppad_name, (po), FALSE))) #define PAD_COMPNAME_GEN(po) SvCUR(AvARRAY(PL_comppad_name)[po]) diff --git a/sv.h b/sv.h index 5474074..9e5ae2b 100644 --- a/sv.h +++ b/sv.h @@ -937,6 +937,13 @@ in gv.h: */ ((SvFLAGS(sv) & (SVpad_NAME|SVpad_OUR)) == (SVpad_NAME|SVpad_OUR)) #define SvPAD_OUR_on(sv) (SvFLAGS(sv) |= SVpad_NAME|SVpad_OUR) +#define OURSTASH(sv) (SvPAD_OUR(sv) ? GvSTASH(sv) : NULL) +#define OURSTASH_set(sv, st) \ + STMT_START { \ + assert(SvTYPE(sv) == SVt_PVGV); \ + GvSTASH(sv) = st; \ + } STMT_END + #ifdef PERL_DEBUG_COW #define SvRV(sv) (0 + (sv)->sv_u.svu_rv) #else