core/set: Add a function for clearing sets
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
parent
09c87e14aa
commit
82a74dd5ec
|
@ -39,6 +39,11 @@ static inline void set_remove(struct set *set, unsigned int value)
|
|||
g_hash_table_remove(set->s_set, GUINT_TO_POINTER(value));
|
||||
}
|
||||
|
||||
static inline void set_clear(struct set *set)
|
||||
{
|
||||
g_hash_table_remove_all(set->s_set);
|
||||
}
|
||||
|
||||
static inline bool set_has(const struct set *set, unsigned int value)
|
||||
{
|
||||
return g_hash_table_contains(set->s_set, GUINT_TO_POINTER(value));
|
||||
|
|
|
@ -37,6 +37,9 @@ void test_set()
|
|||
i += 2;
|
||||
} test_loop_passed();
|
||||
|
||||
set_clear(&set);
|
||||
test_equal(set_size(&set), 0);
|
||||
|
||||
set_deinit(&set);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue