summaryrefslogtreecommitdiff
path: root/gv.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2006-02-27 12:00:12 +0000
committerNicholas Clark <nick@ccl4.org>2006-02-27 12:00:12 +0000
commit3b6733bfa57f98be8915f7c25b14180d042dd456 (patch)
treeb2bb362b15b17a5384afbf8422eb44d7200a0f0e /gv.c
parente3791f55fe376839bdc13891f7e7c9d16d98ee43 (diff)
downloadperl-3b6733bfa57f98be8915f7c25b14180d042dd456.tar.gz
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
Diffstat (limited to 'gv.c')
-rw-r--r--gv.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/gv.c b/gv.c
index 2bbb97bebc..00fed57a86 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);