dbwrap: early return, removes an indentation level
authorRalph Boehme <slow@samba.org>
Sat, 18 Nov 2017 11:13:15 +0000 (12:13 +0100)
committerJeremy Allison <jra@samba.org>
Wed, 12 Sep 2018 20:25:19 +0000 (22:25 +0200)
No change in behaviour.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/lib/dbwrap/dbwrap_open.c

index 0a7edabdbc3234e503d2ce759c48f5017707cc1a..c8dfd9103a85a688c266c76ca7e64b861dbfdfab 100644 (file)
@@ -65,6 +65,7 @@ struct db_context *db_open(TALLOC_CTX *mem_ctx,
 {
        struct db_context *result = NULL;
        const char *base;
 {
        struct db_context *result = NULL;
        const char *base;
+       struct loadparm_context *lp_ctx = NULL;
 
        if (!DBWRAP_LOCK_ORDER_VALID(lock_order)) {
                errno = EINVAL;
 
        if (!DBWRAP_LOCK_ORDER_VALID(lock_order)) {
                errno = EINVAL;
@@ -159,27 +160,26 @@ struct db_context *db_open(TALLOC_CTX *mem_ctx,
                                }
                                return NULL;
                        }
                                }
                                return NULL;
                        }
+
+                       return result;
                }
        }
 
                }
        }
 
-       if (result == NULL) {
-               struct loadparm_context *lp_ctx = loadparm_init_s3(mem_ctx, loadparm_s3_helpers());
+       lp_ctx = loadparm_init_s3(mem_ctx, loadparm_s3_helpers());
 
 
-               if (hash_size == 0) {
-                       hash_size = lpcfg_tdb_hash_size(lp_ctx, name);
-               }
-               tdb_flags = lpcfg_tdb_flags(lp_ctx, tdb_flags);
-
-               result = dbwrap_local_open(
-                       mem_ctx,
-                       name,
-                       hash_size,
-                       tdb_flags,
-                       open_flags,
-                       mode,
-                       lock_order,
-                       dbwrap_flags);
-               talloc_unlink(mem_ctx, lp_ctx);
+       if (hash_size == 0) {
+               hash_size = lpcfg_tdb_hash_size(lp_ctx, name);
        }
        }
+       tdb_flags = lpcfg_tdb_flags(lp_ctx, tdb_flags);
+
+       result = dbwrap_local_open(mem_ctx,
+                                  name,
+                                  hash_size,
+                                  tdb_flags,
+                                  open_flags,
+                                  mode,
+                                  lock_order,
+                                  dbwrap_flags);
+       talloc_unlink(mem_ctx, lp_ctx);
        return result;
 }
        return result;
 }