mdbx: косметический рефакторинг контроля `MDBX_APPEND`.
This commit is contained in:
parent
16cda5c2e8
commit
3da23da7b3
12
src/core.c
12
src/core.c
|
@ -17172,15 +17172,15 @@ static __hot int cursor_put_nochecklen(MDBX_cursor *mc, const MDBX_val *key,
|
||||||
if ((flags & MDBX_APPEND) && mc->mc_db->md_entries > 0) {
|
if ((flags & MDBX_APPEND) && mc->mc_db->md_entries > 0) {
|
||||||
rc = cursor_last(mc, &dkey, &olddata);
|
rc = cursor_last(mc, &dkey, &olddata);
|
||||||
if (likely(rc == MDBX_SUCCESS)) {
|
if (likely(rc == MDBX_SUCCESS)) {
|
||||||
rc = mc->mc_dbx->md_cmp(key, &dkey);
|
const int cmp = mc->mc_dbx->md_cmp(key, &dkey);
|
||||||
if (likely(rc > 0)) {
|
if (likely(cmp > 0)) {
|
||||||
mc->mc_ki[mc->mc_top]++; /* step forward for appending */
|
mc->mc_ki[mc->mc_top]++; /* step forward for appending */
|
||||||
rc = MDBX_NOTFOUND;
|
rc = MDBX_NOTFOUND;
|
||||||
} else {
|
} else if (unlikely(cmp != 0)) {
|
||||||
if (unlikely(rc != MDBX_SUCCESS))
|
/* new-key < last-key */
|
||||||
/* new-key < last-key
|
|
||||||
* or new-key == last-key without MDBX_APPENDDUP */
|
|
||||||
return MDBX_EKEYMISMATCH;
|
return MDBX_EKEYMISMATCH;
|
||||||
|
} else {
|
||||||
|
rc = MDBX_SUCCESS;
|
||||||
exact = true;
|
exact = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue