summaryrefslogtreecommitdiff
path: root/hv.c
diff options
context:
space:
mode:
authorNick Ing-Simmons <nik@tiuk.ti.com>1998-01-24 12:02:34 +0000
committerNick Ing-Simmons <nik@tiuk.ti.com>1998-01-24 12:02:34 +0000
commit67a38de0970070c8aa928e300768e725698b3516 (patch)
tree397c37ef7b089378b20e2cd74f1dd039b17662df /hv.c
parent31da6858e76569983828f43aec742159e881d627 (diff)
downloadperl-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.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/hv.c b/hv.c
index 5a0f9d2473..25f14220fb 100644
--- a/hv.c
+++ b/hv.c
@@ -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) {