From c33c0a69986e49988103e97e5010a6c9e80a0fbb Mon Sep 17 00:00:00 2001 From: Dmitry Podgorny Date: Wed, 29 Oct 2014 18:43:06 +0200 Subject: [PATCH] hash: removed useless condition in hash_iter_next Situation ((entry != NULL) && (i >= table->length)) can never happen. --- src/hash.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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; }