SvREFCNT_dec(gp->gp_sv);
SvREFCNT_dec(gp->gp_av);
+ if(gp->gp_hv && PL_stashcache)
+ hv_delete(PL_stashcache, HvNAME(gp->gp_hv), strlen(HvNAME(gp->gp_hv)), G_DISCARD);
SvREFCNT_dec(gp->gp_hv);
SvREFCNT_dec(gp->gp_io);
SvREFCNT_dec(gp->gp_cv);
hfreeentries(hv);
Safefree(xhv->xhv_array /* HvARRAY(hv) */);
if (HvNAME(hv)) {
- if(PL_stashcache)
- hv_delete_ent(PL_stashcache, sv_2mortal(newSVpv(HvNAME(hv),0)), G_DISCARD, 0);
+ if(PL_stashcache)
+ hv_delete(PL_stashcache, HvNAME(hv), strlen(HvNAME(hv)), G_DISCARD);
Safefree(HvNAME(hv));
HvNAME(hv) = 0;
}
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;
}
}
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 */