mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-31 11:18:21 +08:00
lmdb: ITS#8200 Fix mdb_midl_shrink() usage, return void.
Change-Id: I506a170d434178d43f01b3e9597c4a03b3b3e7a7
This commit is contained in:
parent
862cfc30c4
commit
23af429b3f
4
mdb.c
4
mdb.c
@ -3080,7 +3080,7 @@ mdb_txn_reset0(MDB_txn *txn, const char *act_)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!txn->mt_parent) {
|
if (!txn->mt_parent) {
|
||||||
if (mdb_midl_shrink(&txn->mt_free_pgs))
|
mdb_midl_shrink(&txn->mt_free_pgs);
|
||||||
env->me_free_pgs = txn->mt_free_pgs;
|
env->me_free_pgs = txn->mt_free_pgs;
|
||||||
/* me_pgstate: */
|
/* me_pgstate: */
|
||||||
env->me_pghead = NULL;
|
env->me_pghead = NULL;
|
||||||
@ -3768,7 +3768,7 @@ mdb_txn_commit(MDB_txn *txn)
|
|||||||
|
|
||||||
mdb_midl_free(env->me_pghead);
|
mdb_midl_free(env->me_pghead);
|
||||||
env->me_pghead = NULL;
|
env->me_pghead = NULL;
|
||||||
if (mdb_midl_shrink(&txn->mt_free_pgs))
|
mdb_midl_shrink(&txn->mt_free_pgs);
|
||||||
env->me_free_pgs = txn->mt_free_pgs;
|
env->me_free_pgs = txn->mt_free_pgs;
|
||||||
|
|
||||||
if (mdb_audit_enabled())
|
if (mdb_audit_enabled())
|
||||||
|
4
midl.c
4
midl.c
@ -116,7 +116,7 @@ void mdb_midl_free(MDB_IDL ids)
|
|||||||
free(ids-1);
|
free(ids-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int mdb_midl_shrink( MDB_IDL *idp )
|
void mdb_midl_shrink( MDB_IDL *idp )
|
||||||
{
|
{
|
||||||
MDB_IDL ids = *idp;
|
MDB_IDL ids = *idp;
|
||||||
if (*(--ids) > MDB_IDL_UM_MAX &&
|
if (*(--ids) > MDB_IDL_UM_MAX &&
|
||||||
@ -124,9 +124,7 @@ int mdb_midl_shrink( MDB_IDL *idp )
|
|||||||
{
|
{
|
||||||
*ids++ = MDB_IDL_UM_MAX;
|
*ids++ = MDB_IDL_UM_MAX;
|
||||||
*idp = ids;
|
*idp = ids;
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mdb_midl_grow( MDB_IDL *idp, int num )
|
static int mdb_midl_grow( MDB_IDL *idp, int num )
|
||||||
|
3
midl.h
3
midl.h
@ -98,9 +98,8 @@ void mdb_midl_free(MDB_IDL ids);
|
|||||||
/** Shrink an IDL.
|
/** Shrink an IDL.
|
||||||
* Return the IDL to the default size if it has grown larger.
|
* Return the IDL to the default size if it has grown larger.
|
||||||
* @param[in,out] idp Address of the IDL to shrink.
|
* @param[in,out] idp Address of the IDL to shrink.
|
||||||
* @return 0 on no change, non-zero if shrunk.
|
|
||||||
*/
|
*/
|
||||||
int mdb_midl_shrink(MDB_IDL *idp);
|
void mdb_midl_shrink(MDB_IDL *idp);
|
||||||
|
|
||||||
/** Make room for num additional elements in an IDL.
|
/** Make room for num additional elements in an IDL.
|
||||||
* @param[in,out] idp Address of the IDL.
|
* @param[in,out] idp Address of the IDL.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user