| 280 | } |
| 281 | |
| 282 | static dictEntry *dictNext(dictIterator *iter) { |
| 283 | while (1) { |
| 284 | if (iter->entry == NULL) { |
| 285 | iter->index++; |
| 286 | if (iter->index >= |
| 287 | (signed)iter->ht->size) break; |
| 288 | iter->entry = iter->ht->table[iter->index]; |
| 289 | } else { |
| 290 | iter->entry = iter->nextEntry; |
| 291 | } |
| 292 | if (iter->entry) { |
| 293 | /* We need to save the 'next' here, the iterator user |
| 294 | * may delete the entry we are returning. */ |
| 295 | iter->nextEntry = iter->entry->next; |
| 296 | return iter->entry; |
| 297 | } |
| 298 | } |
| 299 | return NULL; |
| 300 | } |
| 301 | |
| 302 | static void dictReleaseIterator(dictIterator *iter) { |
| 303 | hi_free(iter); |