summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hv.c2
-rw-r--r--hv.h1
-rw-r--r--mro.c6
3 files changed, 5 insertions, 4 deletions
diff --git a/hv.c b/hv.c
index da8d76421d..bc1d4f9eba 100644
--- a/hv.c
+++ b/hv.c
@@ -735,7 +735,7 @@ Perl_hv_common(pTHX_ HV *hv, SV *keysv, const char *key, STRLEN klen,
return NULL;
}
if (action & HV_FETCH_LVALUE) {
- val = newSV(0);
+ val = action & HV_FETCH_EMPTY_HE ? NULL : newSV(0);
if (SvMAGICAL(hv)) {
/* At this point the old hv_fetch code would call to hv_store,
which in turn might do some tied magic. So we need to make that
diff --git a/hv.h b/hv.h
index 81a4d89beb..33ecef5d0f 100644
--- a/hv.h
+++ b/hv.h
@@ -590,6 +590,7 @@ a string/length pair, and no precomputed hash.
#define HV_FETCH_LVALUE 0x10
#define HV_FETCH_JUST_SV 0x20
#define HV_DELETE 0x40
+#define HV_FETCH_EMPTY_HE 0x80 /* Leave HeVAL null. */
/*
=for apidoc newHV
diff --git a/mro.c b/mro.c
index 47f99e4129..750699415f 100644
--- a/mro.c
+++ b/mro.c
@@ -831,7 +831,7 @@ S_mro_gather_and_rename(pTHX_ HV * const stashes, HV *stash, HV *oldstash,
= (HE *)
hv_common(
stashes, NULL, (const char *)&oldstash, sizeof(HV *), 0,
- HV_FETCH_LVALUE, NULL, 0
+ HV_FETCH_LVALUE|HV_FETCH_EMPTY_HE, NULL, 0
);
if(HeVAL(entry) == (SV *)oldstash) {
oldstash = NULL;
@@ -887,7 +887,7 @@ S_mro_gather_and_rename(pTHX_ HV * const stashes, HV *stash, HV *oldstash,
= (HE *)
hv_common(
stashes, NULL, (const char *)&stash, sizeof(HV *), 0,
- HV_FETCH_LVALUE, NULL, 0
+ HV_FETCH_LVALUE|HV_FETCH_EMPTY_HE, NULL, 0
);
if(HeVAL(entry) == &PL_sv_yes || HeVAL(entry) == (SV *)stash)
stash = NULL;
@@ -918,7 +918,7 @@ S_mro_gather_and_rename(pTHX_ HV * const stashes, HV *stash, HV *oldstash,
= (HE *)
hv_common(
stashes, NULL, (const char *)&revstash, sizeof(HV *), 0,
- HV_FETCH_LVALUE, NULL, 0
+ HV_FETCH_LVALUE|HV_FETCH_EMPTY_HE, NULL, 0
);
HeVAL(entry) = (SV *)revstash;