summaryrefslogtreecommitdiffstats
path: root/dhash
diff options
context:
space:
mode:
authorDmitri Pal <dpal@redhat.com>2012-12-23 15:14:08 -0500
committerOndrej Kos <okos@redhat.com>2013-01-04 14:04:18 +0100
commite984e914b6aced5dabe250ad769c63186f21f8b8 (patch)
tree437bfd3657b02c033f9e9bafb654cb394bcb57a5 /dhash
parent89243948c4f0499e70ca5bdbad62f03fd3cfb6a4 (diff)
downloadding-libs-e984e914b6aced5dabe250ad769c63186f21f8b8.tar.gz
ding-libs-e984e914b6aced5dabe250ad769c63186f21f8b8.tar.xz
ding-libs-e984e914b6aced5dabe250ad769c63186f21f8b8.zip
Make CLANG happy
Address CLANG issues in the main code.
Diffstat (limited to 'dhash')
-rw-r--r--dhash/dhash.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/dhash/dhash.c b/dhash/dhash.c
index 79f9c38..efd7c8d 100644
--- a/dhash/dhash.c
+++ b/dhash/dhash.c
@@ -888,12 +888,17 @@ int hash_get_default(hash_table_t *table, hash_key_t *key, hash_value_t *value,
if (!table) return HASH_ERROR_BAD_TABLE;
- if ((error = hash_lookup(table, key, value)) != HASH_SUCCESS) {
- if ((error = hash_enter(table, key, default_value)) != HASH_SUCCESS) {
+ error = hash_lookup(table, key, value);
+ if (error == HASH_ERROR_KEY_NOT_FOUND) {
+
+ error = hash_enter(table, key, default_value);
+ if (error != HASH_SUCCESS) {
return error;
}
*value = *default_value;
return HASH_SUCCESS;
+ } else {
+ if (error != HASH_SUCCESS) return error;
}
return HASH_SUCCESS;