mdbx: change mdbx_canary_get() API.

Change-Id: Ie8831d8acb7113916b8a44b870596a9bf1ccc8b2
This commit is contained in:
Leo Yuriev 2017-04-23 18:58:38 +03:00
parent 11ac6a02ff
commit 1bddc9dcbc
2 changed files with 8 additions and 8 deletions

2
mdbx.h
View File

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

View File

@ -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) {