summaryrefslogtreecommitdiff
path: root/hv.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2005-05-31 10:02:12 +0000
committerNicholas Clark <nick@ccl4.org>2005-05-31 10:02:12 +0000
commit9e720f71ce602dbb0ba425fccdc5b863b0188ec2 (patch)
tree8f9e58474e2682df1b1f50978264bbe6696d5af8 /hv.c
parent4b31f1384a4da7df10c2175e609a8c1c5216ef1d (diff)
downloadperl-9e720f71ce602dbb0ba425fccdc5b863b0188ec2.tar.gz
Avoid updating a variable in the loop
p4raw-id: //depot/perl@24646
Diffstat (limited to 'hv.c')
-rw-r--r--hv.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/hv.c b/hv.c
index cffe756eae..215bcc3fc4 100644
--- a/hv.c
+++ b/hv.c
@@ -913,9 +913,9 @@ S_hv_delete_common(pTHX_ HV *hv, SV *keysv, const char *key, STRLEN klen,
{
dVAR;
register XPVHV* xhv;
- register I32 i;
register HE *entry;
register HE **oentry;
+ HE *const *first_entry;
SV *sv;
bool is_utf8;
int masked_flags;
@@ -1006,10 +1006,9 @@ S_hv_delete_common(pTHX_ HV *hv, SV *keysv, const char *key, STRLEN klen,
masked_flags = (k_flags & HVhek_MASK);
- oentry = &(HvARRAY(hv))[hash & (I32) HvMAX(hv)];
+ first_entry = oentry = &(HvARRAY(hv))[hash & (I32) HvMAX(hv)];
entry = *oentry;
- i = 1;
- for (; entry; i=0, oentry = &HeNEXT(entry), entry = *oentry) {
+ for (; entry; oentry = &HeNEXT(entry), entry = *oentry) {
if (HeHASH(entry) != hash) /* strings can't be equal */
continue;
if (HeKLEN(entry) != (I32)klen)
@@ -1055,8 +1054,9 @@ S_hv_delete_common(pTHX_ HV *hv, SV *keysv, const char *key, STRLEN klen,
HvPLACEHOLDERS(hv)++;
} else {
*oentry = HeNEXT(entry);
- if (i && !*oentry)
+ if(!*first_entry) {
xhv->xhv_fill--; /* HvFILL(hv)-- */
+ }
if (xhv->xhv_aux && entry
== ((struct xpvhv_aux *)xhv->xhv_aux)->xhv_eiter /* HvEITER(hv) */)
HvLAZYDEL_on(hv);