mdbx: add MDBX_RESULT_FALSE and MDBX_RESULT_TRUE for libfpta.

This commit is contained in:
Leo Yuriev 2017-01-30 20:13:56 +03:00
parent ab6cc14480
commit 6882d9c104
2 changed files with 7 additions and 5 deletions

10
mdbx.c
View File

@ -118,7 +118,7 @@ mdbx_env_set_syncbytes(MDB_env *env, size_t bytes)
return MDB_VERSION_MISMATCH;
env->me_sync_threshold = bytes;
return env->me_map ? mdb_env_sync(env, 0) : 0;
return env->me_map ? mdb_env_sync(env, 0) : MDB_SUCCESS;
}
void __cold
@ -365,16 +365,16 @@ int mdbx_cursor_eof(MDB_cursor *mc)
return MDB_VERSION_MISMATCH;
if ((mc->mc_flags & C_INITIALIZED) == 0)
return 1;
return MDBX_RESULT_TRUE;
if (mc->mc_snum == 0)
return 1;
return MDBX_RESULT_TRUE;
if ((mc->mc_flags & C_EOF)
&& mc->mc_ki[mc->mc_top] >= NUMKEYS(mc->mc_pg[mc->mc_top]))
return 1;
return MDBX_RESULT_TRUE;
return 0;
return MDBX_RESULT_FALSE;
}
static int mdbx_is_samedata(const MDB_val* a, const MDB_val* b) {

2
mdbx.h
View File

@ -224,6 +224,8 @@ size_t mdbx_canary_get(MDB_txn *txn, mdbx_canary* canary);
int mdbx_cursor_eof(MDB_cursor *mc);
#define MDBX_EMULTIVAL (MDB_LAST_ERRCODE - 42)
#define MDBX_RESULT_FALSE MDB_SUCCESS
#define MDBX_RESULT_TRUE (-1)
int mdbx_replace(MDB_txn *txn, MDB_dbi dbi,
MDB_val *key, MDB_val *new_data, MDB_val *old_data, unsigned flags);