summaryrefslogtreecommitdiff
path: root/hv.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2021-07-31 10:01:54 +0000
committerNicholas Clark <nick@ccl4.org>2021-10-11 11:30:25 +0000
commit15b39af41614cf0fa1a6931a63dba1bbbcd2c2b5 (patch)
treed2a3d73531b2376081a0dfcbf111505d41c6970d /hv.c
parent0095ebd8b96d81e41d1fa374c2d31b189d2dee9e (diff)
downloadperl-15b39af41614cf0fa1a6931a63dba1bbbcd2c2b5.tar.gz
Delete the do_aux code from S_hsplit()
This existed to handle automatically allocating an "aux" structure for larger hashes, to save a (large) reallocation if they needed to be iterated. Now that we no longer store the aux structure in the main hash array, we don't need to take this precaution.
Diffstat (limited to 'hv.c')
-rw-r--r--hv.c28
1 files changed, 0 insertions, 28 deletions
diff --git a/hv.c b/hv.c
index 956e805b5f..4a21571842 100644
--- a/hv.c
+++ b/hv.c
@@ -1430,15 +1430,6 @@ S_hsplit(pTHX_ HV *hv, STRLEN const oldsize, STRLEN newsize)
char *a = (char*) HvARRAY(hv);
HE **aep;
- bool do_aux= (
- /* already have an HvAUX(hv) so we have to move it */
- SvOOK(hv) ||
- /* no HvAUX() but array we are going to allocate is large enough
- * there is no point in saving the space for the iterator, and
- * speeds up later traversals. */
- ( ( hv != PL_strtab ) && ( newsize >= PERL_HV_ALLOC_AUX_SIZE ) )
- );
-
PERL_ARGS_ASSERT_HSPLIT;
if (newsize > MAX_BUCKET_MAX+1)
return;
@@ -1464,25 +1455,6 @@ S_hsplit(pTHX_ HV *hv, STRLEN const oldsize, STRLEN newsize)
#endif
HvARRAY(hv) = (HE**) a;
HvMAX(hv) = newsize - 1;
- /* before we zero the newly added memory, we
- * need to deal with the aux struct that may be there
- * or have been allocated by us*/
- if (do_aux) {
- struct xpvhv_aux *const dest = HvAUX(hv);
- if (!SvOOK(hv)) {
- /* no existing aux structure, but we allocated space for one
- * so initialize it properly. This unrolls hv_auxinit() a bit,
- * since we have to do the realloc anyway. */
- /* first we set the iterator's xhv_rand so it can be copied into lastrand below */
-#ifdef PERL_HASH_RANDOMIZE_KEYS
- dest->xhv_rand = (U32)PL_hash_rand_bits;
-#endif
- /* this is the "non realloc" part of the hv_auxinit() */
- (void)hv_auxinit_internal(dest);
- /* Turn on the OOK flag */
- SvOOK_on(hv);
- }
- }
/* now we can safely clear the second half */
Zero(&a[oldsize * sizeof(HE*)], (newsize-oldsize) * sizeof(HE*), char); /* zero 2nd half*/