diff options
author | Nicholas Clark <nick@ccl4.org> | 2013-02-21 20:54:48 +0100 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2013-02-26 16:00:20 +0100 |
commit | 7663aa67ebf92f85fdb62aee91f2b6af8c7d9cbb (patch) | |
tree | 1c69b57933f319ed63a735c0fe36fa85212cff19 | |
parent | e8c10cf36903c9c33ff8323b6f1a05d27080bc4d (diff) | |
download | perl-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.
-rw-r--r-- | hv.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -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 |