hashmap_free(MAKE_HASHMAP(s));
}
-void set_freep(Set **s) {
- if (!s)
- return;
-
- set_free(*s);
- *s = NULL;
-}
-
void set_free_free(Set *s) {
hashmap_free_free(MAKE_HASHMAP(s));
}
return hashmap_put(MAKE_HASHMAP(s), value, value);
}
+int set_consume(Set *s, void *value) {
+ int r;
+
+ r = set_put(s, value);
+ if (r < 0)
+ free(value);
+
+ return r;
+}
+
int set_replace(Set *s, void *value) {
return hashmap_replace(MAKE_HASHMAP(s), value, value);
}