2015-11-07 11:20:19 -05:00
|
|
|
/*
|
|
|
|
* Copyright 2015 (c) Anna Schumaker.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <core/set.h>
|
|
|
|
|
2015-11-07 11:40:25 -05:00
|
|
|
void set_copy(const struct set *lhs, struct set *rhs)
|
|
|
|
{
|
|
|
|
struct set_iter it_lhs;
|
|
|
|
|
|
|
|
set_for_each(lhs, &it_lhs)
|
|
|
|
set_insert(rhs, it_lhs.it_val);
|
|
|
|
}
|
|
|
|
|
2015-11-07 11:20:19 -05:00
|
|
|
void set_inline_intersect(const struct set *lhs, struct set *rhs)
|
|
|
|
{
|
|
|
|
struct set_iter it_rhs;
|
|
|
|
|
|
|
|
set_for_each(rhs, &it_rhs) {
|
|
|
|
if (!set_has(lhs, it_rhs.it_val))
|
|
|
|
g_hash_table_iter_remove(&it_rhs.it_iter);
|
|
|
|
}
|
|
|
|
}
|