From f45d40a88bc10b2d1abab43712469309a26c6d98 Mon Sep 17 00:00:00 2001 From: Hallvard Furuseth Date: Sat, 4 May 2013 10:03:19 +0200 Subject: [PATCH] Cleaner "Support mdb_txn_abort(a reset txn)". Redo 8a562f560edcc6417672df453c4e626dfb4c4024 so !mt_dbxs indicates "txn was reset", so mt_numdbs gets one magic value instead of two. --- libraries/liblmdb/mdb.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libraries/liblmdb/mdb.c b/libraries/liblmdb/mdb.c index 96ca73fb03..14b13822e9 100644 --- a/libraries/liblmdb/mdb.c +++ b/libraries/liblmdb/mdb.c @@ -1871,7 +1871,7 @@ mdb_txn_renew(MDB_txn *txn) { int rc; - if (!txn || txn->mt_numdbs || !(txn->mt_flags & MDB_TXN_RDONLY)) + if (!txn || txn->mt_dbxs) /* A reset txn has mt_dbxs==NULL */ return EINVAL; if (txn->mt_env->me_flags & MDB_FATAL_ERROR) { @@ -2014,7 +2014,8 @@ mdb_txn_reset0(MDB_txn *txn) if (!(env->me_flags & MDB_NOTLS)) txn->mt_u.reader = NULL; /* txn does not own reader */ } - txn->mt_numdbs = 0; /* mark txn as reset, do not close DBs again */ + txn->mt_numdbs = 0; /* close nothing if called again */ + txn->mt_dbxs = NULL; /* mark txn as reset */ } else { MDB_page *dp; -- 2.39.5