diff options
author | Artur Bergman <sky@nanisky.com> | 2003-04-14 21:15:00 +0000 |
---|---|---|
committer | Artur Bergman <sky@nanisky.com> | 2003-04-14 21:15:00 +0000 |
commit | 7e8961ecc77ac069ddd54d220ef48fd89f1122d6 (patch) | |
tree | 8e4a939671b8c9010c43b51fcf99f7cc2698363f /pp_hot.c | |
parent | 00bf5cd963bef6a3dffb6f796fe06e66184d13f0 (diff) | |
download | perl-7e8961ecc77ac069ddd54d220ef48fd89f1122d6.tar.gz |
Fixes to bugs introduced by PL_stashcache
A) Follow suggestion by Benjamin Goldberg to use hv_delete
instead of hv_delete_ent to avoid creating a temporary SV
B) Don't increment the refcount, sneak it into an IV instead
C) When a GP is a deleted that contains a stash, remove the
corresponding entry since hv might be in use in other places.
D) Note that no test cases test the deletion of packages to catch
this bug.
p4raw-id: //depot/perl@19212
Diffstat (limited to 'pp_hot.c')
-rw-r--r-- | pp_hot.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -2928,9 +2928,10 @@ S_method_common(pTHX_ SV* meth, U32* hashp) packname = Nullch; if(SvOK(sv) && (packname = SvPV(sv, packlen))) { - HE* he = hv_fetch_ent(PL_stashcache, sv, 0, 0); + HE* he; + he = hv_fetch_ent(PL_stashcache, sv, 0, 0); if (he) { - stash = (HV*)HeVAL(he); + stash = (HV*)SvIV(HeVAL(he)); goto fetch; } } @@ -2956,10 +2957,9 @@ S_method_common(pTHX_ SV* meth, U32* hashp) if (!stash) packsv = sv; else { - SvREFCNT_inc((SV*)stash); - if(!hv_store(PL_stashcache, packname, packlen, (SV*)stash, 0)) - SvREFCNT_dec((SV*)stash); - } + SV* ref = newSViv((IV)stash); + hv_store(PL_stashcache, packname, packlen, ref, 0); + } goto fetch; } /* it _is_ a filehandle name -- replace with a reference */ |