mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-02 02:14:13 +08:00
mdbx: minor refine cursor_set_ex()
.
Change-Id: I0951a917c1e4c9e372f29c64fda0e1b267f48cdd
This commit is contained in:
parent
dc7098b3fb
commit
e4db019f47
37
src/core.c
37
src/core.c
@ -13504,24 +13504,27 @@ static int mdbx_cursor_set_ex(MDBX_cursor *mc, MDBX_val *key, MDBX_val *data,
|
||||
|
||||
set2:
|
||||
node = mdbx_node_search(mc, &aligned_key, exactp);
|
||||
if (!*exactp && op != MDBX_SET_RANGE) {
|
||||
/* MDBX_SET specified and not an exact match. */
|
||||
if (unlikely(mc->mc_ki[mc->mc_top] >= page_numkeys(mc->mc_pg[mc->mc_top])))
|
||||
mc->mc_flags |= C_EOF;
|
||||
return MDBX_NOTFOUND;
|
||||
}
|
||||
|
||||
if (node == NULL) {
|
||||
mdbx_debug("%s", "===> inexact leaf not found, goto sibling");
|
||||
if (unlikely((rc = mdbx_cursor_sibling(mc, SIBLING_RIGHT)) !=
|
||||
MDBX_SUCCESS)) {
|
||||
mc->mc_flags |= C_EOF;
|
||||
return rc; /* no entries matched */
|
||||
if (!*exactp) {
|
||||
if (op != MDBX_SET_RANGE) {
|
||||
/* MDBX_SET specified and not an exact match. */
|
||||
if (unlikely(mc->mc_ki[mc->mc_top] >=
|
||||
page_numkeys(mc->mc_pg[mc->mc_top])))
|
||||
mc->mc_flags |= C_EOF;
|
||||
return MDBX_NOTFOUND;
|
||||
}
|
||||
|
||||
if (node == NULL) {
|
||||
mdbx_debug("%s", "===> inexact leaf not found, goto sibling");
|
||||
if (unlikely((rc = mdbx_cursor_sibling(mc, SIBLING_RIGHT)) !=
|
||||
MDBX_SUCCESS)) {
|
||||
mc->mc_flags |= C_EOF;
|
||||
return rc; /* no entries matched */
|
||||
}
|
||||
mp = mc->mc_pg[mc->mc_top];
|
||||
mdbx_cassert(mc, IS_LEAF(mp));
|
||||
if (!IS_LEAF2(mp))
|
||||
node = page_node(mp, 0);
|
||||
}
|
||||
mp = mc->mc_pg[mc->mc_top];
|
||||
mdbx_cassert(mc, IS_LEAF(mp));
|
||||
if (!IS_LEAF2(mp))
|
||||
node = page_node(mp, 0);
|
||||
}
|
||||
mdbx_cassert(mc,
|
||||
mc->mc_ki[mc->mc_top] < page_numkeys(mc->mc_pg[mc->mc_top]) ||
|
||||
|
Loading…
x
Reference in New Issue
Block a user