mdbx: fix minor Coverity warnings.

Change-Id: I0c5d23a36120b8d697887462a6ae86d66a435c3d
This commit is contained in:
Leonid Yuriev 2021-01-22 20:13:31 +03:00
parent b82d1d5063
commit b1a2892038
2 changed files with 4 additions and 7 deletions

View File

@ -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;
}

View File

@ -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 */