diff options
author | Nick Ing-Simmons <nik@tiuk.ti.com> | 1998-01-24 12:02:34 +0000 |
---|---|---|
committer | Nick Ing-Simmons <nik@tiuk.ti.com> | 1998-01-24 12:02:34 +0000 |
commit | 67a38de0970070c8aa928e300768e725698b3516 (patch) | |
tree | 397c37ef7b089378b20e2cd74f1dd039b17662df /hv.c | |
parent | 31da6858e76569983828f43aec742159e881d627 (diff) | |
download | perl-67a38de0970070c8aa928e300768e725698b3516.tar.gz |
Gisle's av_unshift tweak, two small patches from chip
and check for NULL in hv_delete in case '~' and tie magic
are present
p4raw-id: //depot/ansiperl@438
Diffstat (limited to 'hv.c')
-rw-r--r-- | hv.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -423,6 +423,7 @@ hv_delete(HV *hv, char *key, U32 klen, I32 flags) register U32 hash; register HE *entry; register HE **oentry; + SV **svp; SV *sv; if (!hv) @@ -432,8 +433,8 @@ hv_delete(HV *hv, char *key, U32 klen, I32 flags) bool needs_store; hv_magic_check (hv, &needs_copy, &needs_store); - if (needs_copy) { - sv = *hv_fetch(hv, key, klen, TRUE); + if (needs_copy && (svp = hv_fetch(hv, key, klen, TRUE))) { + sv = *svp; mg_clear(sv); if (!needs_store) { if (mg_find(sv, 'p')) { @@ -501,8 +502,7 @@ hv_delete_ent(HV *hv, SV *keysv, I32 flags, U32 hash) bool needs_store; hv_magic_check (hv, &needs_copy, &needs_store); - if (needs_copy) { - entry = hv_fetch_ent(hv, keysv, TRUE, hash); + if (needs_copy && (entry = hv_fetch_ent(hv, keysv, TRUE, hash))) { sv = HeVAL(entry); mg_clear(sv); if (!needs_store) { |