chiark / gitweb /
core: add new ConditionArchitecture() that checks the architecture returned by uname...
[elogind.git] / src / shared / set.c
index 53399b655b43daafe615489cdbadac8e9dfe17e9..5a4bf11bdfda45b01d4ef63ad9220c127c2daa99 100644 (file)
@@ -37,14 +37,6 @@ void set_free(Set* s) {
         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));
 }
@@ -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);
 }