From: Nicholas Clark Date: Thu, 21 Feb 2013 18:58:04 +0000 (+0100) Subject: Tweak S_hsplit() to return early if there are no keys to process. X-Git-Tag: v5.17.10~180^2~6^2~4 X-Git-Url: https://perl5.git.perl.org/perl5.git/commitdiff_plain/68303b5c043fa83afa9518dd6d3882960216ac4d Tweak S_hsplit() to return early if there are no keys to process. This mimics the behaviour in Perl_hv_ksplit(). Also remove a vestigial comment. The code it relates to was removed in commit 7dc8663964c66a69 in Nov 2012. --- diff --git a/hv.c b/hv.c index 51fe12d..dabf384 100644 --- a/hv.c +++ b/hv.c @@ -1124,8 +1124,11 @@ S_hsplit(pTHX_ HV *hv, STRLEN const oldsize, STRLEN newsize) Zero(&a[oldsize * sizeof(HE*)], (newsize-oldsize) * sizeof(HE*), char); /* zero 2nd half*/ HvMAX(hv) = --newsize; HvARRAY(hv) = (HE**) a; - aep = (HE**)a; + if (!HvTOTALKEYS(hv)) /* skip rest if no entries */ + return; + + aep = (HE**)a; for (i=0; i