From ffd2287b5505dd56a1ed12bf5f5fb903ff2fc8ea Mon Sep 17 00:00:00 2001 From: Hallvard Furuseth Date: Thu, 8 Aug 2013 19:54:54 +0200 Subject: [PATCH] Factor out MDB_env. --- libraries/liblmdb/mdb.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/libraries/liblmdb/mdb.c b/libraries/liblmdb/mdb.c index 345d6d6..c2e75e5 100644 --- a/libraries/liblmdb/mdb.c +++ b/libraries/liblmdb/mdb.c @@ -4452,12 +4452,11 @@ mdb_cursor_push(MDB_cursor *mc, MDB_page *mp) static int mdb_page_get(MDB_txn *txn, pgno_t pgno, MDB_page **ret, int *lvl) { + MDB_env *env = txn->mt_env; MDB_page *p = NULL; int level; - if (!((txn->mt_flags & MDB_TXN_RDONLY) | - (txn->mt_env->me_flags & MDB_WRITEMAP))) - { + if (!((txn->mt_flags & MDB_TXN_RDONLY) | (env->me_flags & MDB_WRITEMAP))) { MDB_txn *tx2 = txn; level = 1; do { @@ -4471,7 +4470,7 @@ mdb_page_get(MDB_txn *txn, pgno_t pgno, MDB_page **ret, int *lvl) if (tx2->mt_spill_pgs) { x = mdb_midl_search(tx2->mt_spill_pgs, pgno); if (x <= tx2->mt_spill_pgs[0] && tx2->mt_spill_pgs[x] == pgno) { - p = (MDB_page *)(txn->mt_env->me_map + txn->mt_env->me_psize * pgno); + p = (MDB_page *)(env->me_map + env->me_psize * pgno); goto done; } } @@ -4488,7 +4487,7 @@ mdb_page_get(MDB_txn *txn, pgno_t pgno, MDB_page **ret, int *lvl) if (pgno < txn->mt_next_pgno) { level = 0; - p = (MDB_page *)(txn->mt_env->me_map + txn->mt_env->me_psize * pgno); + p = (MDB_page *)(env->me_map + env->me_psize * pgno); } else { DPRINTF("page %"Z"u not found", pgno); assert(p != NULL);