projects
/
platform
/
upstream
/
perl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
359164a
)
Perl_hv_fill(), count empty chains down, rather than used chains up.
author
Nicholas Clark
<nick@ccl4.org>
Sat, 13 Mar 2010 11:23:46 +0000
(11:23 +0000)
committer
Nicholas Clark
<nick@ccl4.org>
Fri, 21 May 2010 17:56:25 +0000
(18:56 +0100)
The assumption is that most chains of a hash are in use.
Suggestion and initial patch by Ruslan Zakirov.
hv.c
patch
|
blob
|
history
diff --git
a/hv.c
b/hv.c
index
244feb6
..
1ff73b0
100644
(file)
--- a/
hv.c
+++ b/
hv.c
@@
-1880,12
+1880,13
@@
Perl_hv_fill(pTHX_ HV const *const hv)
PERL_ARGS_ASSERT_HV_FILL;
if (ents) {
- HE *const *const end = ents + HvMAX(hv);
+ HE *const *const last = ents + HvMAX(hv);
+ count = last + 1 - ents;
do {
- if (*ents)
-
++
count;
- } while (++ents <=
end
);
+ if (
!
*ents)
+
--
count;
+ } while (++ents <=
last
);
}
return count;
}