From: Nicholas Clark Date: Tue, 12 Dec 2006 19:54:05 +0000 (+0000) Subject: pads haven't actually contained any PVGVs since change 27313. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=63f10712f341adad800caf833beeb6f5def358fe;p=p5sagit%2Fp5-mst-13.2.git pads haven't actually contained any PVGVs since change 27313. So correct the docs and assert this in the code. p4raw-id: //depot/perl@29535 --- diff --git a/pad.c b/pad.c index 3b52c20..4ff62e2 100644 --- a/pad.c +++ b/pad.c @@ -74,7 +74,7 @@ in PL_op->op_targ), wasting a name SV for them doesn't make sense. The SVs in the names AV have their PV being the name of the variable. NV+1..IV inclusive is a range of cop_seq numbers for which the name is valid. For typed lexicals name SV is SVt_PVMG and SvSTASH points at the -type. For C lexicals, the type is also SVt_PVGV, with the MAGIC slot +type. For C lexicals, the type is also SVt_PVMG, with the OURSTASH slot pointing at the stash of the associated global (so that duplicate C declarations in the same package can be detected). SvCUR is sometimes hijacked to store the generation number during compilation. @@ -347,6 +347,7 @@ Perl_pad_add_name(pTHX_ const char *name, HV* typestash, HV* ourstash, bool fake sv_setpv(namesv, name); if (typestash) { + assert(SvTYPE(namesv) == SVt_PVMG); SvPAD_TYPED_on(namesv); SvSTASH_set(namesv, (HV*)SvREFCNT_inc_simple_NN((SV*)typestash)); } diff --git a/sv.c b/sv.c index cd186e4..6211689 100644 --- a/sv.c +++ b/sv.c @@ -5102,6 +5102,7 @@ Perl_sv_clear(pTHX_ register SV *sv) } if (type >= SVt_PVMG) { if ((type == SVt_PVMG || type == SVt_PVGV) && SvPAD_OUR(sv)) { + assert(type != SVt_PVGV); SvREFCNT_dec(OURSTASH(sv)); } else if (SvMAGIC(sv)) mg_free(sv);