From b1a2892038c6193149e4bef9b002b1434607cf88 Mon Sep 17 00:00:00 2001 From: Leonid Yuriev Date: Fri, 22 Jan 2021 20:13:31 +0300 Subject: [PATCH] mdbx: fix minor Coverity warnings. Change-Id: I0c5d23a36120b8d697887462a6ae86d66a435c3d --- src/core.c | 7 ++----- src/defs.h | 4 ++-- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/core.c b/src/core.c index 964c20c1..26704fd4 100644 --- a/src/core.c +++ b/src/core.c @@ -11434,9 +11434,6 @@ __cold int mdbx_env_open(MDBX_env *env, const char *pathname, } env->me_flags = (flags & ~MDBX_FATAL_ERROR) | MDBX_ENV_ACTIVE; - if (unlikely(rc != MDBX_SUCCESS)) - goto bailout; - env->me_pathname = mdbx_calloc(env_pathname.ent_len + 1, 1); env->me_dbxs = mdbx_calloc(env->me_maxdbs, sizeof(MDBX_dbx)); env->me_dbflags = mdbx_calloc(env->me_maxdbs, sizeof(env->me_dbflags[0])); @@ -14984,7 +14981,7 @@ void mdbx_cursor_close(MDBX_cursor *mc) { MDBX_cursor **prev = &txn->tw.cursors[mc->mc_dbi]; while (*prev && *prev != mc) prev = &(*prev)->mc_next; - mdbx_cassert(mc, *prev == mc); + mdbx_tassert(txn, *prev == mc); *prev = mc->mc_next; } mc->mc_signature = 0; @@ -14992,7 +14989,7 @@ void mdbx_cursor_close(MDBX_cursor *mc) { mdbx_free(mc); } else { /* Cursor closed before nested txn ends */ - mdbx_cassert(mc, mc->mc_signature == MDBX_MC_LIVE); + mdbx_tassert(txn, mc->mc_signature == MDBX_MC_LIVE); mdbx_ensure(txn->mt_env, check_txn_rw(txn, 0) == MDBX_SUCCESS); mc->mc_signature = MDBX_MC_WAIT4EOT; } diff --git a/src/defs.h b/src/defs.h index 3f61e6f7..30566668 100644 --- a/src/defs.h +++ b/src/defs.h @@ -235,7 +235,7 @@ # if (defined(__GNUC__) || __has_builtin(__builtin_expect)) && !defined(__COVERITY__) # define likely(cond) __builtin_expect(!!(cond), 1) # else -# define likely(x) (x) +# define likely(x) (!!(x)) # endif #endif /* likely */ @@ -243,7 +243,7 @@ # if (defined(__GNUC__) || __has_builtin(__builtin_expect)) && !defined(__COVERITY__) # define unlikely(cond) __builtin_expect(!!(cond), 0) # else -# define unlikely(x) (x) +# define unlikely(x) (!!(x)) # endif #endif /* unlikely */