Permit hashtable_foreach iterator to remove the current entry
This commit is contained in:
parent
97b610452f
commit
0cab9ca4f5
|
@ -132,9 +132,11 @@ void hashtable_foreach(hashtable_t *table,
|
|||
{
|
||||
int i;
|
||||
for (i = 0; i < table->bucket_count; i++) {
|
||||
hashtable_entry_t *chain;
|
||||
for (chain = table->buckets[i]; chain != NULL; chain = chain->next) {
|
||||
hashtable_entry_t *chain = table->buckets[i];
|
||||
while (chain != NULL) {
|
||||
hashtable_entry_t *next = chain->next;
|
||||
iterator(context, chain->key, chain->value);
|
||||
chain = next;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue