Add uc_htable_remove + test
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user