Revert "Add iterator API". Will try to find a better API
This reverts commit 821399a61b.
This commit is contained in:
@@ -171,47 +171,3 @@ int uc_htable_resize(struct UHTable *table, size_t buckets)
|
||||
}
|
||||
|
||||
|
||||
struct UHNode *uc_htable_iter_first_hash(struct UHTable *table,
|
||||
struct UHIter *iter, size_t hash)
|
||||
{
|
||||
size_t bucket = uc_htable_bucket(table, hash);
|
||||
struct UHNode **it= &table->buckets[bucket];
|
||||
|
||||
while (*it) {
|
||||
if ((*it)->hash == hash) {
|
||||
iter->it = it;
|
||||
iter->cur_bucket = bucket;
|
||||
iter->cur_hash = (*it)->hash;
|
||||
iter->next = &(*it)->next;
|
||||
return *it;
|
||||
}
|
||||
|
||||
it = &(*it)->next;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct UHNode *uc_htable_iter_next_hash(struct UHIter *iter)
|
||||
{
|
||||
struct UHNode **it = iter->next;
|
||||
|
||||
while (*it) {
|
||||
if ((*it)->hash == iter->cur_hash) {
|
||||
iter->it = it;
|
||||
iter->next = &(*it)->next;
|
||||
return *it;
|
||||
}
|
||||
it = &(*it)->next;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void uc_htable_iter_remove(struct UHIter *iter)
|
||||
{
|
||||
if (*iter->it) {
|
||||
*iter->it = *iter->next;
|
||||
iter->it = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user