Skip to content

Commit 4b58502

Browse files
hfuruhyc
authored andcommitted
ITS#8200 Fix mdb_midl_shrink() usage, return void
1 parent 1fd0341 commit 4b58502

File tree

3 files changed

+6
-9
lines changed

3 files changed

+6
-9
lines changed

libraries/liblmdb/mdb.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2822,8 +2822,8 @@ mdb_txn_reset0(MDB_txn *txn, const char *act)
28222822
}
28232823

28242824
if (!txn->mt_parent) {
2825-
if (mdb_midl_shrink(&txn->mt_free_pgs))
2826-
env->me_free_pgs = txn->mt_free_pgs;
2825+
mdb_midl_shrink(&txn->mt_free_pgs);
2826+
env->me_free_pgs = txn->mt_free_pgs;
28272827
/* me_pgstate: */
28282828
env->me_pghead = NULL;
28292829
env->me_pglast = 0;
@@ -3409,8 +3409,8 @@ mdb_txn_commit(MDB_txn *txn)
34093409

34103410
mdb_midl_free(env->me_pghead);
34113411
env->me_pghead = NULL;
3412-
if (mdb_midl_shrink(&txn->mt_free_pgs))
3413-
env->me_free_pgs = txn->mt_free_pgs;
3412+
mdb_midl_shrink(&txn->mt_free_pgs);
3413+
env->me_free_pgs = txn->mt_free_pgs;
34143414

34153415
#if (MDB_DEBUG) > 2
34163416
mdb_audit(txn);

libraries/liblmdb/midl.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,17 +116,15 @@ void mdb_midl_free(MDB_IDL ids)
116116
free(ids-1);
117117
}
118118

119-
int mdb_midl_shrink( MDB_IDL *idp )
119+
void mdb_midl_shrink( MDB_IDL *idp )
120120
{
121121
MDB_IDL ids = *idp;
122122
if (*(--ids) > MDB_IDL_UM_MAX &&
123123
(ids = realloc(ids, (MDB_IDL_UM_MAX+1) * sizeof(MDB_ID))))
124124
{
125125
*ids++ = MDB_IDL_UM_MAX;
126126
*idp = ids;
127-
return 1;
128127
}
129-
return 0;
130128
}
131129

132130
static int mdb_midl_grow( MDB_IDL *idp, int num )

libraries/liblmdb/midl.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,8 @@ void mdb_midl_free(MDB_IDL ids);
9898
/** Shrink an IDL.
9999
* Return the IDL to the default size if it has grown larger.
100100
* @param[in,out] idp Address of the IDL to shrink.
101-
* @return 0 on no change, non-zero if shrunk.
102101
*/
103-
int mdb_midl_shrink(MDB_IDL *idp);
102+
void mdb_midl_shrink(MDB_IDL *idp);
104103

105104
/** Make room for num additional elements in an IDL.
106105
* @param[in,out] idp Address of the IDL.

0 commit comments

Comments
 (0)