chiark / gitweb /
core: add new ConditionArchitecture() that checks the architecture returned by uname...
[elogind.git] / src / shared / set.c
index 5f83c50839ae78b831d6f3853eea7ce6c6eb89a4..5a4bf11bdfda45b01d4ef63ad9220c127c2daa99 100644 (file)
@@ -49,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);
 }