From 3d08b9e76f81f65bb7f4e8dd0baddd7ee1ec2bbe Mon Sep 17 00:00:00 2001 From: Leo Yuriev Date: Tue, 21 Feb 2017 17:16:01 +0300 Subject: [PATCH] mdbx: fix mdbx_node_search(). --- mdbx.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/mdbx.c b/mdbx.c index 961cf7bb..fbeaff94 100644 --- a/mdbx.c +++ b/mdbx.c @@ -5558,11 +5558,9 @@ static MDB_node *__hot mdbx_node_search(MDB_cursor *mc, MDB_val *key, } } - if (rc > 0) { /* Found entry is less than the key. */ - i++; /* Skip to get the smallest entry larger than key. */ - if (!IS_LEAF2(mp)) - node = NODEPTR(mp, i); - } + if (rc > 0) /* Found entry is less than the key. */ + i++; /* Skip to get the smallest entry larger than key. */ + if (exactp) *exactp = (rc == 0 && nkeys > 0); /* store the key index */ @@ -5572,7 +5570,7 @@ static MDB_node *__hot mdbx_node_search(MDB_cursor *mc, MDB_val *key, return NULL; /* nodeptr is fake for LEAF2 */ - return node; + return IS_LEAF2(mp) ? node : NODEPTR(mp, i); } #if 0