diff --git a/src/hash.c b/src/hash.c index e28fda0..5bc4690 100644 --- a/src/hash.c +++ b/src/hash.c @@ -250,13 +250,13 @@ const char * hash_iter_next(hash_iterator_t *iter) { hash_t *table = iter->table; hashentry_t *entry = iter->entry; - int i = iter->index; + int i; /* advance until we find the next entry */ if (entry != NULL) entry = entry->next; if (entry == NULL) { /* we're off the end of list, search for a new entry */ - i++; + i = iter->index + 1; while (i < iter->table->length) { entry = table->entries[i]; if (entry != NULL) { @@ -267,7 +267,7 @@ const char * hash_iter_next(hash_iterator_t *iter) } } - if ((entry == NULL) || (i >= table->length)) { + if (entry == NULL) { /* no more keys! */ return NULL; }