summaryrefslogtreecommitdiff
path: root/hv.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2010-10-28 22:22:10 -0700
committerFather Chrysostomos <sprout@cpan.org>2010-10-29 05:42:37 -0700
commit3f783763058d08aba0b7beff15293b731b2a8cdc (patch)
treef6b7af5ae1dbe0cad1796a7a5b28135903c760c6 /hv.c
parent711fbbf07a97253fa75c4b25bdb69e1912b58425 (diff)
downloadperl-3f783763058d08aba0b7beff15293b731b2a8cdc.tar.gz
hv_ename_delete should not delete the HvNAME
This is something that 78b79c7758 missed. When xhv_name is a HEK *, it is both the regular name and the effect- ive name at the same time. Only when xhv_name_count is negative is the regular name not also the effective name. hv_ename_delete needs to take the HEK that xhv_name points to and put it in a new HEK * array in xhv_name. This array will just have one element. When xhv_name_count is negative, effective names start with the second element. So we set xhv_name_count to -1 so there isn’t one.
Diffstat (limited to 'hv.c')
-rw-r--r--hv.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/hv.c b/hv.c
index 72793e5959..91b8b8c68d 100644
--- a/hv.c
+++ b/hv.c
@@ -2180,8 +2180,10 @@ Perl_hv_ename_delete(pTHX_ HV *hv, const char *name, U32 len)
HEK_LEN(aux->xhv_name) == (I32)len
&& memEQ(HEK_KEY(aux->xhv_name), name, len)
) {
- unshare_hek_or_pvn(aux->xhv_name, 0, 0, 0);
- aux->xhv_name = NULL;
+ const HEK * const namehek = aux->xhv_name;
+ Newxc(aux->xhv_name, 1, HEK *, HEK);
+ *(const HEK **)aux->xhv_name = namehek;
+ aux->xhv_name_count = -1;
}
}