From 6617b2db35ec6f5f5acb979bf672414a1f9e5657 Mon Sep 17 00:00:00 2001 From: Ralph Boehme Date: Sat, 18 Nov 2017 12:13:15 +0100 Subject: [PATCH] dbwrap: early return, removes an indentation level No change in behaviour. Signed-off-by: Ralph Boehme Reviewed-by: Jeremy Allison --- source3/lib/dbwrap/dbwrap_open.c | 34 ++++++++++++++++---------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/source3/lib/dbwrap/dbwrap_open.c b/source3/lib/dbwrap/dbwrap_open.c index 0a7edabdbc3..c8dfd9103a8 100644 --- a/source3/lib/dbwrap/dbwrap_open.c +++ b/source3/lib/dbwrap/dbwrap_open.c @@ -65,6 +65,7 @@ struct db_context *db_open(TALLOC_CTX *mem_ctx, { struct db_context *result = NULL; const char *base; + struct loadparm_context *lp_ctx = NULL; 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 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; } -- 2.47.2