Commit 9269c410 authored by Vitaly Arbuzov's avatar Vitaly Arbuzov
Browse files

Refactor dbIteratorNext

parent 6a10146f
...@@ -63,13 +63,8 @@ dict *dbIteratorNextDict(dbIterator *dbit) { ...@@ -63,13 +63,8 @@ dict *dbIteratorNextDict(dbIterator *dbit) {
/* Returns next entry from the multi slot db. */ /* Returns next entry from the multi slot db. */
dictEntry *dbIteratorNext(dbIterator *dbit) { dictEntry *dbIteratorNext(dbIterator *dbit) {
if (!dbit->di.d) { /* No current dict, need to get a new one. */ dictEntry *de = dbit->di.d ? dictNext(&dbit->di) : NULL;
dict *d = dbIteratorNextDict(dbit); if (!de) { /* No current dict or reached the end of the dictionary. */
if (!d) return NULL;
dictInitSafeIterator(&dbit->di, d);
}
dictEntry *de = dictNext(&dbit->di);
if (!de) { /* Reached the end of the dictionary, check if there are more. */
dict *d = dbIteratorNextDict(dbit); dict *d = dbIteratorNextDict(dbit);
if (!d) return NULL; if (!d) return NULL;
dictInitSafeIterator(&dbit->di, d); dictInitSafeIterator(&dbit->di, d);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment