aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/hashtab.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/hashtab.c')
-rw-r--r--src/nvim/hashtab.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/src/nvim/hashtab.c b/src/nvim/hashtab.c
index 5b0dc508fa..6b90c4fee4 100644
--- a/src/nvim/hashtab.c
+++ b/src/nvim/hashtab.c
@@ -329,24 +329,25 @@ static void hash_may_resize(hashtab_T *ht, size_t minitems)
size_t todo = ht->ht_used;
for (hashitem_T *olditem = oldarray; todo > 0; ++olditem) {
- if (!HASHITEM_EMPTY(olditem)) {
- // The algorithm to find the spot to add the item is identical to
- // the algorithm to find an item in hash_lookup(). But we only
- // need to search for a NULL key, thus it's simpler.
- hash_T newi = olditem->hi_hash & newmask;
- hashitem_T *newitem = &newarray[newi];
- if (newitem->hi_key != NULL) {
- for (hash_T perturb = olditem->hi_hash;; perturb >>= PERTURB_SHIFT) {
- newi = 5 * newi + perturb + 1;
- newitem = &newarray[newi & newmask];
- if (newitem->hi_key == NULL) {
- break;
- }
+ if (HASHITEM_EMPTY(olditem)) {
+ continue;
+ }
+ // The algorithm to find the spot to add the item is identical to
+ // the algorithm to find an item in hash_lookup(). But we only
+ // need to search for a NULL key, thus it's simpler.
+ hash_T newi = olditem->hi_hash & newmask;
+ hashitem_T *newitem = &newarray[newi];
+ if (newitem->hi_key != NULL) {
+ for (hash_T perturb = olditem->hi_hash;; perturb >>= PERTURB_SHIFT) {
+ newi = 5 * newi + perturb + 1;
+ newitem = &newarray[newi & newmask];
+ if (newitem->hi_key == NULL) {
+ break;
}
}
- *newitem = *olditem;
- todo--;
}
+ *newitem = *olditem;
+ todo--;
}
if (ht->ht_array != ht->ht_smallarray) {