summaryrefslogtreecommitdiff
path: root/src/shared/set.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared/set.c')
-rw-r--r--src/shared/set.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/shared/set.c b/src/shared/set.c
index 5f83c50839..c338dc3a44 100644
--- a/src/shared/set.c
+++ b/src/shared/set.c
@@ -49,6 +49,13 @@ int set_put(Set *s, void *value) {
return hashmap_put(MAKE_HASHMAP(s), value, value);
}
+int set_consume(Set *s, void *value) {
+ int 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);
}