summaryrefslogtreecommitdiff
path: root/hv.c
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2011-05-03 16:07:51 +0100
committerDavid Mitchell <davem@iabyn.com>2011-05-19 14:49:43 +0100
commit5f243b5ff09626b3b2ed4569515c4a27a2a18137 (patch)
tree28867c60838fa58fbc688442f41807c677ca1d86 /hv.c
parentd5683f9a2482a20fa3a244bc371a0f172d409e5b (diff)
downloadperl-5f243b5ff09626b3b2ed4569515c4a27a2a18137.tar.gz
hfreeentries zeros HvARRAY now, so skip manual
Formerly, hv_clear() and hv_undef() zeroed the contents of HvARRAY after calling hfreeentries(), but that sub now zeroes each elements as a by-product of its deleting algorithm. So we can skip the Zero().
Diffstat (limited to 'hv.c')
-rw-r--r--hv.c13
1 files changed, 1 insertions, 12 deletions
diff --git a/hv.c b/hv.c
index 44f385bd3a..4ac1b17ba2 100644
--- a/hv.c
+++ b/hv.c
@@ -1544,8 +1544,6 @@ Perl_hv_clear(pTHX_ HV *hv)
else {
hfreeentries(hv);
HvPLACEHOLDERS_set(hv, 0);
- if (HvARRAY(hv))
- Zero(HvARRAY(hv), xhv->xhv_max+1 /* HvMAX(hv)+1 */, HE*);
if (SvRMAGICAL(hv))
mg_clear(MUTABLE_SV(hv));
@@ -1745,17 +1743,10 @@ Perl_hv_undef_flags(pTHX_ HV *hv, U32 flags)
if (SvOOK(hv)) {
struct xpvhv_aux * const aux = HvAUX(hv);
struct mro_meta *meta;
- bool zeroed = FALSE;
if ((name = HvENAME_get(hv))) {
- if (PL_phase != PERL_PHASE_DESTRUCT) {
- /* This must come at this point in case
- mro_isa_changed_in dies. */
- Zero(HvARRAY(hv), xhv->xhv_max+1 /* HvMAX(hv)+1 */, HE*);
- zeroed = TRUE;
-
+ if (PL_phase != PERL_PHASE_DESTRUCT)
mro_isa_changed_in(hv);
- }
if (PL_stashcache)
(void)hv_delete(
PL_stashcache, name, HvENAMELEN_get(hv), G_DISCARD
@@ -1789,8 +1780,6 @@ Perl_hv_undef_flags(pTHX_ HV *hv, U32 flags)
}
if (!aux->xhv_name_u.xhvnameu_name && ! aux->xhv_backreferences)
SvFLAGS(hv) &= ~SVf_OOK;
- else if (!zeroed)
- Zero(HvARRAY(hv), xhv->xhv_max+1 /* HvMAX(hv)+1 */, HE*);
}
if (!SvOOK(hv)) {
Safefree(HvARRAY(hv));