mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-02 00:14:14 +08:00
mdbx: change mdbx_canary_get() API.
Change-Id: Ie8831d8acb7113916b8a44b870596a9bf1ccc8b2
This commit is contained in:
parent
11ac6a02ff
commit
1bddc9dcbc
2
mdbx.h
2
mdbx.h
@ -1728,7 +1728,7 @@ LIBMDBX_API int mdbx_env_pgwalk(MDB_txn *txn, MDBX_pgvisitor_func *visitor,
|
||||
typedef struct mdbx_canary { uint64_t x, y, z, v; } mdbx_canary;
|
||||
|
||||
LIBMDBX_API int mdbx_canary_put(MDB_txn *txn, const mdbx_canary *canary);
|
||||
LIBMDBX_API size_t mdbx_canary_get(MDB_txn *txn, mdbx_canary *canary);
|
||||
LIBMDBX_API int mdbx_canary_get(MDB_txn *txn, mdbx_canary *canary);
|
||||
|
||||
/* Returns:
|
||||
* - MDBX_RESULT_TRUE when no more data available
|
||||
|
14
src/mdbx.c
14
src/mdbx.c
@ -9792,14 +9792,14 @@ int mdbx_canary_put(MDB_txn *txn, const mdbx_canary *canary) {
|
||||
return MDB_SUCCESS;
|
||||
}
|
||||
|
||||
size_t mdbx_canary_get(MDB_txn *txn, mdbx_canary *canary) {
|
||||
if (unlikely(!txn || txn->mt_signature != MDBX_MT_SIGNATURE))
|
||||
return 0;
|
||||
int mdbx_canary_get(MDB_txn *txn, mdbx_canary *canary) {
|
||||
if (unlikely(txn == NULL || canary == NULL))
|
||||
return EINVAL;
|
||||
if (unlikely(txn->mt_signature != MDBX_MT_SIGNATURE))
|
||||
return MDBX_EBADSIGN;
|
||||
|
||||
if (likely(canary))
|
||||
*canary = txn->mt_canary;
|
||||
|
||||
return txn->mt_txnid;
|
||||
*canary = txn->mt_canary;
|
||||
return MDB_SUCCESS;
|
||||
}
|
||||
|
||||
int mdbx_cursor_on_first(MDB_cursor *mc) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user