dbwrap_tdb: move a function call out of an if condition
authorRalph Boehme <slow@samba.org>
Sat, 18 Aug 2018 07:12:21 +0000 (09:12 +0200)
committerJeremy Allison <jra@samba.org>
Wed, 12 Sep 2018 20:25:19 +0000 (22:25 +0200)
At least for me this improves readability somewhat. No change in
behaviour.

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

index f597645..19f2f00 100644 (file)
@@ -116,13 +116,16 @@ static struct db_record *db_tdb_fetch_locked_internal(
        struct db_tdb_ctx *ctx = talloc_get_type_abort(db->private_data,
                                                       struct db_tdb_ctx);
        struct tdb_fetch_locked_state state;
+       int ret;
 
        state.mem_ctx = mem_ctx;
        state.result = NULL;
 
-       if ((tdb_parse_record(ctx->wtdb->tdb, key, db_tdb_fetchlock_parse,
-                             &state) < 0) &&
-           (tdb_error(ctx->wtdb->tdb) != TDB_ERR_NOEXIST)) {
+       ret = tdb_parse_record(ctx->wtdb->tdb,
+                              key,
+                              db_tdb_fetchlock_parse,
+                              &state);
+       if ((ret < 0) && (tdb_error(ctx->wtdb->tdb) != TDB_ERR_NOEXIST)) {
                tdb_chainunlock(ctx->wtdb->tdb, key);
                return NULL;
        }