summaryrefslogtreecommitdiff
path: root/hv.c
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>1998-04-08 00:14:13 +0000
committerGurusamy Sarathy <gsar@cpan.org>1998-04-08 00:14:13 +0000
commitba3eb2af450c2577c20a691fb686a5e02955c48b (patch)
treea8cf1145dc0c922547f90f92d9c444715752d512 /hv.c
parent00dc2f4f23da07658d2634f904ac3a098aaa4153 (diff)
parent8c9208bc5764dada175aceff9d0b1938978d7db6 (diff)
downloadperl-ba3eb2af450c2577c20a691fb686a5e02955c48b.tar.gz
[asperl] integrate mainline changes
p4raw-id: //depot/asperl@884
Diffstat (limited to 'hv.c')
-rw-r--r--hv.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/hv.c b/hv.c
index 3474761503..463cf301a3 100644
--- a/hv.c
+++ b/hv.c
@@ -96,8 +96,8 @@ hv_fetch(HV *hv, char *key, U32 klen, I32 lval)
dTHR;
sv = sv_newmortal();
mg_copy((SV*)hv, sv, key, klen);
- Sv = sv;
- return &Sv;
+ hv_fetch_sv = sv;
+ return &hv_fetch_sv;
}
#ifdef ENV_IS_CASELESS
else if (mg_find((SV*)hv,'E')) {
@@ -172,17 +172,18 @@ hv_fetch_ent(HV *hv, SV *keysv, I32 lval, register U32 hash)
if (SvRMAGICAL(hv)) {
if (mg_find((SV*)hv,'P')) {
+ dTHR;
sv = sv_newmortal();
keysv = sv_2mortal(newSVsv(keysv));
mg_copy((SV*)hv, sv, (char*)keysv, HEf_SVKEY);
- if (!HeKEY_hek(&mh)) {
+ if (!HeKEY_hek(&hv_fetch_ent_mh)) {
char *k;
New(54, k, HEK_BASESIZE + sizeof(SV*), char);
- HeKEY_hek(&mh) = (HEK*)k;
+ HeKEY_hek(&hv_fetch_ent_mh) = (HEK*)k;
}
- HeSVKEY_set(&mh, keysv);
- HeVAL(&mh) = sv;
- return &mh;
+ HeSVKEY_set(&hv_fetch_ent_mh, keysv);
+ HeVAL(&hv_fetch_ent_mh) = sv;
+ return &hv_fetch_ent_mh;
}
#ifdef ENV_IS_CASELESS
else if (mg_find((SV*)hv,'E')) {
@@ -837,11 +838,14 @@ newHV(void)
void
hv_free_ent(HV *hv, register HE *entry)
{
+ SV *val;
+
if (!entry)
return;
- if (isGV(HeVAL(entry)) && GvCVu(HeVAL(entry)) && HvNAME(hv))
+ val = HeVAL(entry);
+ if (val && isGV(val) && GvCVu(val) && HvNAME(hv))
sub_generation++; /* may be deletion of method from stash */
- SvREFCNT_dec(HeVAL(entry));
+ SvREFCNT_dec(val);
if (HeKLEN(entry) == HEf_SVKEY) {
SvREFCNT_dec(HeKEY_sv(entry));
Safefree(HeKEY_hek(entry));