chiark / gitweb /
core: add new ConditionArchitecture() that checks the architecture returned by uname...
[elogind.git] / src / shared / set.c
index 111d53bb36e6bd95d50348ddd03ed02e24d44a01..5a4bf11bdfda45b01d4ef63ad9220c127c2daa99 100644 (file)
@@ -37,18 +37,10 @@ void set_free(Set* s) {
         hashmap_free(MAKE_HASHMAP(s));
 }
 
-void set_freep(Set **s) {
-        set_free(*s);
-}
-
 void set_free_free(Set *s) {
         hashmap_free_free(MAKE_HASHMAP(s));
 }
 
-void set_free_freep(Set **s) {
-        set_free_free(*s);
-}
-
 int set_ensure_allocated(Set **s, hash_func_t hash_func, compare_func_t compare_func) {
         return hashmap_ensure_allocated((Hashmap**) s, hash_func, compare_func);
 }
@@ -57,6 +49,16 @@ int set_put(Set *s, void *value) {
         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);
 }