hash: removed useless condition in hash_iter_next
Situation ((entry != NULL) && (i >= table->length)) can never happen.
This commit is contained in:
@@ -250,13 +250,13 @@ const char * hash_iter_next(hash_iterator_t *iter)
|
|||||||
{
|
{
|
||||||
hash_t *table = iter->table;
|
hash_t *table = iter->table;
|
||||||
hashentry_t *entry = iter->entry;
|
hashentry_t *entry = iter->entry;
|
||||||
int i = iter->index;
|
int i;
|
||||||
|
|
||||||
/* advance until we find the next entry */
|
/* advance until we find the next entry */
|
||||||
if (entry != NULL) entry = entry->next;
|
if (entry != NULL) entry = entry->next;
|
||||||
if (entry == NULL) {
|
if (entry == NULL) {
|
||||||
/* we're off the end of list, search for a new entry */
|
/* we're off the end of list, search for a new entry */
|
||||||
i++;
|
i = iter->index + 1;
|
||||||
while (i < iter->table->length) {
|
while (i < iter->table->length) {
|
||||||
entry = table->entries[i];
|
entry = table->entries[i];
|
||||||
if (entry != NULL) {
|
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! */
|
/* no more keys! */
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user