diff options
author | Father Chrysostomos <sprout@cpan.org> | 2010-10-28 22:22:10 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2010-10-29 05:42:37 -0700 |
commit | 3f783763058d08aba0b7beff15293b731b2a8cdc (patch) | |
tree | f6b7af5ae1dbe0cad1796a7a5b28135903c760c6 /hv.c | |
parent | 711fbbf07a97253fa75c4b25bdb69e1912b58425 (diff) | |
download | perl-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.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -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; } } |