summaryrefslogtreecommitdiff
path: root/hv.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2013-02-21 20:54:48 +0100
committerNicholas Clark <nick@ccl4.org>2013-02-26 16:00:20 +0100
commit7663aa67ebf92f85fdb62aee91f2b6af8c7d9cbb (patch)
tree1c69b57933f319ed63a735c0fe36fa85212cff19 /hv.c
parente8c10cf36903c9c33ff8323b6f1a05d27080bc4d (diff)
downloadperl-7663aa67ebf92f85fdb62aee91f2b6af8c7d9cbb.tar.gz
In S_hsplit(), replace a for with a do/while, as the loop runs at least once.
Seems pointless to check the exit condition before any iterations, when we know that it will always be false the first time.
Diffstat (limited to 'hv.c')
-rw-r--r--hv.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/hv.c b/hv.c
index 9d619d006a..af722f6802 100644
--- a/hv.c
+++ b/hv.c
@@ -1100,7 +1100,7 @@ STATIC void
S_hsplit(pTHX_ HV *hv, STRLEN const oldsize, STRLEN newsize)
{
dVAR;
- STRLEN i;
+ STRLEN i = 0;
char *a = (char*) HvARRAY(hv);
HE **aep;
@@ -1129,7 +1129,7 @@ S_hsplit(pTHX_ HV *hv, STRLEN const oldsize, STRLEN newsize)
return;
aep = (HE**)a;
- for (i=0; i<oldsize; i++) {
+ do {
HE **oentry = aep + i;
HE *entry = aep[i];
@@ -1147,7 +1147,7 @@ S_hsplit(pTHX_ HV *hv, STRLEN const oldsize, STRLEN newsize)
}
entry = *oentry;
} while (entry);
- }
+ } while (i++ < oldsize);
}
void