diff options
Diffstat (limited to 'src/basic/hashmap.c')
-rw-r--r-- | src/basic/hashmap.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/basic/hashmap.c b/src/basic/hashmap.c index 75ea2e30b..c89630f04 100644 --- a/src/basic/hashmap.c +++ b/src/basic/hashmap.c @@ -1777,20 +1777,18 @@ int set_consume(Set *s, void *value) { int set_put_strdup(Set *s, const char *p) { char *c; - int r; assert(s); assert(p); + if (set_contains(s, (char*) p)) + return 0; + c = strdup(p); if (!c) return -ENOMEM; - r = set_consume(s, c); - if (r == -EEXIST) - return 0; - - return r; + return set_consume(s, c); } #if 0 /// UNNEEDED by elogind |