remove unnecessary error check 35/85135/1
authorJiwoong Im <jiwoong.im@samsung.com>
Wed, 24 Aug 2016 02:07:12 +0000 (11:07 +0900)
committerJiwoong Im <jiwoong.im@samsung.com>
Wed, 24 Aug 2016 02:07:12 +0000 (11:07 +0900)
- check only the existence of the key before create key

Change-Id: Ieff93c62f36f0e13fa65e02c84edd9b0f9ede9ac
Signed-off-by: Jiwoong Im <jiwoong.im@samsung.com>
backend/gdbm.c
common/direct.c

index ef00447..d62be1a 100644 (file)
@@ -117,7 +117,7 @@ static int close_db(const char *dbpath)
 
        db = g_hash_table_lookup(dbs, dbpath);
 
-       if(!db)
+       if (!db)
                return 0;
 
        g_hash_table_remove(dbs, dbpath);
index 1ee8cce..7004432 100644 (file)
@@ -335,9 +335,6 @@ int direct_create(const struct buxton_layer *layer, const char *key,
                return -1;
 
        r = get_val(ly, layer->uid, BUXTON_LAYER_BASE, key, NULL, NULL, NULL);
-       if (r == -1 && errno != ENOENT)
-               return -1;
-
        if (r == 0) {
                errno = EEXIST;
                return -1;
@@ -345,7 +342,7 @@ int direct_create(const struct buxton_layer *layer, const char *key,
 
        r = direct_close(layer, ly);
 
-       if (r == -1){
+       if (r == -1) {
                bxt_err("failed to close db(%s)", ly->name);
                return -1;
        }