diff options
author | Chip Salzenberg <chip@pobox.com> | 1998-02-03 04:16:50 -0500 |
---|---|---|
committer | Malcolm Beattie <mbeattie@sable.ox.ac.uk> | 1998-02-06 14:56:30 +0000 |
commit | 85aff5773f2412a54180cc35f86370c56b65bf77 (patch) | |
tree | 58aa1481b34d450e99d317950157b92887658fa2 /gv.c | |
parent | e1c148c28bf3335bbd0ad9a2070b0917265c00c3 (diff) | |
download | perl-85aff5773f2412a54180cc35f86370c56b65bf77.tar.gz |
Some Chip patches (some tweaked to match _5x source):
Subject: [PATCH] local leakage
Date: Tue, 3 Feb 1998 09:16:50 -0500 (EST)
Subject: [PATCH] NULs in patterns
Date: Wed, 4 Feb 1998 01:33:51 -0500 (EST)
Subject: [PATCH] Configure on PerlIO
Date: Wed, 4 Feb 1998 01:38:43 -0500 (EST)
Subject: [PATCH] Avoid core dump on package alias
Date: Wed, 4 Feb 1998 15:38:42 -0500 (EST)
Subject: [PATCH] Fix name of $Foo::{'Bar::'}
Date: Wed, 4 Feb 1998 16:37:51 -0500 (EST)
p4raw-id: //depot/perl@462
Diffstat (limited to 'gv.c')
-rw-r--r-- | gv.c | 17 |
1 files changed, 9 insertions, 8 deletions
@@ -97,7 +97,7 @@ gv_init(GV *gv, HV *stash, char *name, STRLEN len, int multi) GvFILEGV(gv) = curcop->cop_filegv; GvEGV(gv) = gv; sv_magic((SV*)gv, (SV*)gv, '*', name, len); - GvSTASH(gv) = stash; + GvSTASH(gv) = (HV*)SvREFCNT_inc(stash); GvNAME(gv) = savepvn(name, len); GvNAMELEN(gv) = len; if (multi) @@ -421,14 +421,15 @@ gv_fetchpv(char *nambeg, I32 add, I32 sv_type) tmpbuf[len++] = ':'; tmpbuf[len] = '\0'; gvp = (GV**)hv_fetch(stash,tmpbuf,len,add); + gv = gvp ? *gvp : Nullgv; + if (gv && gv != (GV*)&sv_undef) { + if (SvTYPE(gv) != SVt_PVGV) + gv_init(gv, stash, tmpbuf, len, (add & 2)); + else + GvMULTI_on(gv); + } Safefree(tmpbuf); - if (!gvp || *gvp == (GV*)&sv_undef) - return Nullgv; - gv = *gvp; - - if (SvTYPE(gv) == SVt_PVGV) - GvMULTI_on(gv); - else if (!add) + if (!gv || gv == (GV*)&sv_undef) return Nullgv; else gv_init(gv, stash, nambeg, namend - nambeg, (add & 2)); |