mdbx: refine mdbx_cursor_eof().

Change-Id: I786c5f2eedb273f44fd2ef5065d200f63dfec84b
This commit is contained in:
Leo Yuriev 2017-01-12 22:36:52 +03:00
parent 460eb64a6f
commit 71ae2aba8d

12
mdbx.c
View File

@ -366,7 +366,17 @@ int mdbx_cursor_eof(MDB_cursor *mc)
if (unlikely(mc->mc_signature != MDBX_MC_SIGNATURE)) if (unlikely(mc->mc_signature != MDBX_MC_SIGNATURE))
return MDB_VERSION_MISMATCH; return MDB_VERSION_MISMATCH;
return (mc->mc_flags & C_INITIALIZED) ? 0 : 1; if ((mc->mc_flags & C_INITIALIZED) == 0)
return 1;
if (mc->mc_snum == 0)
return 1;
if ((mc->mc_flags & C_EOF)
&& mc->mc_ki[mc->mc_top] >= NUMKEYS(mc->mc_pg[mc->mc_top]))
return 1;
return 0;
} }
static int mdbx_is_samedata(const MDB_val* a, const MDB_val* b) { static int mdbx_is_samedata(const MDB_val* a, const MDB_val* b) {