Add uc_htable_remove + test

This commit is contained in:
Nils O. Selåsdal
2013-10-17 22:12:48 +02:00
parent 6c76759355
commit 0f0ae6dd1e
3 changed files with 70 additions and 1 deletions
+16
View File
@@ -113,6 +113,22 @@ void uc_htable_insert(struct UHTable *table, struct UHNode *node, size_t hash)
table->cnt_elements++;
}
void uc_htable_remove(struct UHTable *table, struct UHNode *node)
{
struct UHNode **it = &table->buckets[uc_htable_bucket(table, node->hash)];
while (*it) {
if (*it == node) {
*it = (*it)->next;
table->cnt_elements--;
break;
}
it = &(*it)->next;
}
}
int uc_htable_resize(struct UHTable *table, size_t buckets)
{
struct UHTable tmp_table;