summaryrefslogtreecommitdiff
path: root/src/shared/hashmap.c
diff options
context:
space:
mode:
authorMichal Schmidt <mschmidt@redhat.com>2014-10-13 18:14:07 +0200
committerMichal Schmidt <mschmidt@redhat.com>2014-10-23 17:38:02 +0200
commitbf3d3e2bb7ae2d3854be57f28dd1403c8f7e4c3c (patch)
tree97f43b9f46d79f3331d54468077617faf7b55801 /src/shared/hashmap.c
parent9ba81d5a61b7c992a1d2e5e02f334b8e2a0b0c22 (diff)
hashmap: hashmap_move_one() should return -ENOENT when 'other' is NULL
-ENOENT is the same return value as if 'other' were an allocated hashmap that does not contain the key. A NULL hashmap is a possible way of expressing a hashmap that contains no key.
Diffstat (limited to 'src/shared/hashmap.c')
-rw-r--r--src/shared/hashmap.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/shared/hashmap.c b/src/shared/hashmap.c
index 4c517059f6..c4fde898f8 100644
--- a/src/shared/hashmap.c
+++ b/src/shared/hashmap.c
@@ -886,15 +886,15 @@ int hashmap_move_one(Hashmap *h, Hashmap *other, const void *key) {
unsigned h_hash, other_hash;
struct hashmap_entry *e;
- if (!other)
- return 0;
-
assert(h);
h_hash = bucket_hash(h, key);
if (hash_scan(h, h_hash, key))
return -EEXIST;
+ if (!other)
+ return -ENOENT;
+
other_hash = bucket_hash(other, key);
e = hash_scan(other, other_hash, key);
if (!e)