mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-06 17:34:14 +08:00
mdbx: refine freelist_list() to avoid coverity warnings.
Change-Id: I38eee44e4ca926e7d11ef5e3f7f3ce2e92f71259
This commit is contained in:
parent
a78edd314e
commit
fb9d7a4471
12
src/mdbx.c
12
src/mdbx.c
@ -3066,7 +3066,10 @@ again_on_freelist_change:
|
|||||||
/* LY: note that freeDB cleanup is not needed. */
|
/* LY: note that freeDB cleanup is not needed. */
|
||||||
++cleanup_reclaimed_pos;
|
++cleanup_reclaimed_pos;
|
||||||
}
|
}
|
||||||
|
mdbx_tassert(txn, txn->mt_lifo_reclaimed != NULL);
|
||||||
head_id = txn->mt_lifo_reclaimed[refill_reclaimed_pos];
|
head_id = txn->mt_lifo_reclaimed[refill_reclaimed_pos];
|
||||||
|
} else {
|
||||||
|
mdbx_tassert(txn, txn->mt_lifo_reclaimed == NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (Re)write {key = head_id, IDL length = head_room} */
|
/* (Re)write {key = head_id, IDL length = head_room} */
|
||||||
@ -3132,18 +3135,23 @@ again_on_freelist_change:
|
|||||||
|
|
||||||
size_t rpl_left = env->me_reclaimed_pglist[0];
|
size_t rpl_left = env->me_reclaimed_pglist[0];
|
||||||
pgno_t *rpl_end = env->me_reclaimed_pglist + rpl_left;
|
pgno_t *rpl_end = env->me_reclaimed_pglist + rpl_left;
|
||||||
if (!lifo) {
|
if (txn->mt_lifo_reclaimed == 0) {
|
||||||
|
mdbx_tassert(txn, lifo == 0);
|
||||||
rc = mdbx_cursor_first(&mc, &key, &data);
|
rc = mdbx_cursor_first(&mc, &key, &data);
|
||||||
if (unlikely(rc))
|
if (unlikely(rc))
|
||||||
goto bailout;
|
goto bailout;
|
||||||
|
} else {
|
||||||
|
mdbx_tassert(txn, lifo != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
txnid_t id;
|
txnid_t id;
|
||||||
if (!lifo) {
|
if (txn->mt_lifo_reclaimed == 0) {
|
||||||
|
mdbx_tassert(txn, lifo == 0);
|
||||||
id = *(txnid_t *)key.iov_base;
|
id = *(txnid_t *)key.iov_base;
|
||||||
mdbx_tassert(txn, id <= env->me_last_reclaimed);
|
mdbx_tassert(txn, id <= env->me_last_reclaimed);
|
||||||
} else {
|
} else {
|
||||||
|
mdbx_tassert(txn, lifo != 0);
|
||||||
mdbx_tassert(txn,
|
mdbx_tassert(txn,
|
||||||
refill_reclaimed_pos > 0 &&
|
refill_reclaimed_pos > 0 &&
|
||||||
refill_reclaimed_pos <= txn->mt_lifo_reclaimed[0]);
|
refill_reclaimed_pos <= txn->mt_lifo_reclaimed[0]);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user