FREE (&pptr->table);
FREE (ptr); /* __FREE_CHECKED__ */
}
+
+struct hash_elem *hash_walk(const HASH *table, struct hash_walk_state *state)
+{
+ if (state->last && state->last->next)
+ {
+ state->last = state->last->next;
+ return state->last;
+ }
+
+ if (state->last)
+ state->index++;
+
+ while (state->index < table->nelem)
+ {
+ if (table->table[state->index])
+ {
+ state->last = table->table[state->index];
+ return state->last;
+ }
+ state->index++;
+ }
+
+ state->index = 0;
+ state->last = NULL;
+ return NULL;
+}
+
void hash_destroy (HASH ** hash, void (*destroy) (void *));
+struct hash_walk_state {
+ int index;
+ struct hash_elem *last;
+};
+
+struct hash_elem *hash_walk(const HASH *table, struct hash_walk_state *state);
+
#endif