From: Hallvard Furuseth Date: Mon, 23 Sep 2013 18:13:27 +0000 (+0200) Subject: mdb_pages_xkeep(): Reformat, use common flag mask X-Git-Tag: OPENLDAP_REL_ENG_2_4_37~27^2~22 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=5b96d68fafd1732790ac5f887e5050033a48da42;p=openldap mdb_pages_xkeep(): Reformat, use common flag mask --- diff --git a/libraries/liblmdb/mdb.c b/libraries/liblmdb/mdb.c index 0bc9db798f..b5a3d8242f 100644 --- a/libraries/liblmdb/mdb.c +++ b/libraries/liblmdb/mdb.c @@ -1376,10 +1376,11 @@ mdb_dlist_free(MDB_txn *txn) static int mdb_pages_xkeep(MDB_cursor *mc, unsigned pflags, int all) { + enum { Mask = P_SUBP|P_DIRTY|P_KEEP }; MDB_txn *txn = mc->mc_txn; MDB_cursor *m3; MDB_xcursor *mx; - MDB_page *dp; + MDB_page *dp, *mp; unsigned i, j; int rc = MDB_SUCCESS, level; @@ -1389,13 +1390,14 @@ mdb_pages_xkeep(MDB_cursor *mc, unsigned pflags, int all) for (i = txn->mt_numdbs;; mc = txn->mt_cursors[--i]) { for (; mc; mc=mc->mc_next) { for (m3 = mc; m3->mc_flags & C_INITIALIZED; m3 = &mx->mx_cursor) { - for (j=0; jmc_snum; j++) - if ((m3->mc_pg[j]->mp_flags & (P_SUBP|P_DIRTY|P_KEEP)) - == pflags) - m3->mc_pg[j]->mp_flags ^= P_KEEP; - mx = m3->mc_xcursor; - if (mx == NULL) - break; + for (j=0; jmc_snum; j++) { + mp = m3->mc_pg[j]; + if ((mp->mp_flags & Mask) == pflags) + mp->mp_flags ^= P_KEEP; + } + mx = m3->mc_xcursor; + if (mx == NULL) + break; } } if (i == 0) @@ -1411,7 +1413,7 @@ mdb_pages_xkeep(MDB_cursor *mc, unsigned pflags, int all) continue; if ((rc = mdb_page_get(txn, pgno, &dp, &level)) != MDB_SUCCESS) break; - if ((dp->mp_flags & (P_DIRTY|P_KEEP)) == pflags && level <= 1) + if ((dp->mp_flags & Mask) == pflags && level <= 1) dp->mp_flags ^= P_KEEP; } }