From: Nicholas Clark Date: Mon, 27 Feb 2006 12:00:12 +0000 (+0000) Subject: Change 27330 failed to decontaminate SvCUR/GvFLAGS when upgrading an X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=3b6733bfa57f98be8915f7c25b14180d042dd456;p=p5sagit%2Fp5-mst-13.2.git Change 27330 failed to decontaminate SvCUR/GvFLAGS when upgrading an SvPV acting as a prototype placeholder to a full typeglob. p4raw-id: //depot/perl@27336 --- diff --git a/gv.c b/gv.c index 2bbb97b..00fed57 100644 --- a/gv.c +++ b/gv.c @@ -162,7 +162,8 @@ Perl_gv_init(pTHX_ GV *gv, HV *stash, const char *name, STRLEN len, int multi) { dVAR; register GP *gp; - const bool doproto = SvTYPE(gv) > SVt_NULL; + const U32 old_type = SvTYPE(gv); + const bool doproto = old_type > SVt_NULL; const char * const proto = (doproto && SvPOK(gv)) ? SvPVX_const(gv) : NULL; SV *const has_constant = doproto && SvROK(gv) ? SvRV(gv) : NULL; @@ -183,7 +184,12 @@ Perl_gv_init(pTHX_ GV *gv, HV *stash, const char *name, STRLEN len, int multi) SvROK_off(gv); } - sv_upgrade((SV*)gv, SVt_PVGV); + + if (old_type < SVt_PVGV) { + if (old_type >= SVt_PV) + SvCUR_set(gv, 0); + sv_upgrade((SV*)gv, SVt_PVGV); + } if (SvLEN(gv)) { if (proto) { SvPV_set(gv, NULL);