mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-31 11:08:22 +08:00
mdbx: возвращение MDBX_TXN_INVALID
(INT32_MIN
) из mdbx_txn_flags()
при передаче невалидной транзакции.
This commit is contained in:
parent
fc1685a178
commit
224f26813e
2
mdbx.h
2
mdbx.h
@ -3764,7 +3764,7 @@ mdbx_txn_env(const MDBX_txn *txn);
|
|||||||
* \param [in] txn A transaction handle returned by \ref mdbx_txn_begin().
|
* \param [in] txn A transaction handle returned by \ref mdbx_txn_begin().
|
||||||
*
|
*
|
||||||
* \returns A transaction flags, valid if input is an valid transaction,
|
* \returns A transaction flags, valid if input is an valid transaction,
|
||||||
* otherwise -1. */
|
* otherwise \ref MDBX_TXN_INVALID. */
|
||||||
MDBX_NOTHROW_PURE_FUNCTION LIBMDBX_API int mdbx_txn_flags(const MDBX_txn *txn);
|
MDBX_NOTHROW_PURE_FUNCTION LIBMDBX_API int mdbx_txn_flags(const MDBX_txn *txn);
|
||||||
|
|
||||||
/** \brief Return the transaction's ID.
|
/** \brief Return the transaction's ID.
|
||||||
|
11
src/core.c
11
src/core.c
@ -9570,10 +9570,13 @@ uint64_t mdbx_txn_id(const MDBX_txn *txn) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int mdbx_txn_flags(const MDBX_txn *txn) {
|
int mdbx_txn_flags(const MDBX_txn *txn) {
|
||||||
if (unlikely(!txn || txn->mt_signature != MDBX_MT_SIGNATURE)) {
|
STATIC_ASSERT(
|
||||||
assert((-1 & (int)MDBX_TXN_INVALID) != 0);
|
(MDBX_TXN_INVALID &
|
||||||
return -1;
|
(MDBX_TXN_FINISHED | MDBX_TXN_ERROR | MDBX_TXN_DIRTY | MDBX_TXN_SPILLS |
|
||||||
}
|
MDBX_TXN_HAS_CHILD | MDBX_TXN_DRAINED_GC | MDBX_SHRINK_ALLOWED |
|
||||||
|
MDBX_TXN_RW_BEGIN_FLAGS | MDBX_TXN_RO_BEGIN_FLAGS)) == 0);
|
||||||
|
if (unlikely(!txn || txn->mt_signature != MDBX_MT_SIGNATURE))
|
||||||
|
return MDBX_TXN_INVALID;
|
||||||
assert(0 == (int)(txn->mt_flags & MDBX_TXN_INVALID));
|
assert(0 == (int)(txn->mt_flags & MDBX_TXN_INVALID));
|
||||||
return txn->mt_flags;
|
return txn->mt_flags;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user