summaryrefslogtreecommitdiff
path: root/plugins/Dbx_mdb/src/stdafx.h
diff options
context:
space:
mode:
authorMikalaiR <nikolay.romanovich@narod.ru>2016-07-02 16:06:59 +0000
committerMikalaiR <nikolay.romanovich@narod.ru>2016-07-02 16:06:59 +0000
commitbe556ddb9cca86b4242781761019da7ba6a537d0 (patch)
treecf5d96139fb5dcf79994e04ac11284a64ce1df2e /plugins/Dbx_mdb/src/stdafx.h
parentdba6ba812fadfef61e7adf61ff2a65e03ed36789 (diff)
dbx_lmdb: code cleanup
git-svn-id: http://svn.miranda-ng.org/main/trunk@17056 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Dbx_mdb/src/stdafx.h')
-rw-r--r--plugins/Dbx_mdb/src/stdafx.h20
1 files changed, 12 insertions, 8 deletions
diff --git a/plugins/Dbx_mdb/src/stdafx.h b/plugins/Dbx_mdb/src/stdafx.h
index ebb0c8cc7f..32fbfff7f1 100644
--- a/plugins/Dbx_mdb/src/stdafx.h
+++ b/plugins/Dbx_mdb/src/stdafx.h
@@ -26,6 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <process.h>
#include <memory>
#include <vector>
+#include <functional>
#include <newpluginapi.h>
#include <win2k.h>
@@ -50,10 +51,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
class txn_ptr
{
+ MDB_env *m_env;
MDB_txn *m_txn;
-
public:
- __forceinline txn_ptr(MDB_env *pEnv)
+ __forceinline txn_ptr(MDB_env *pEnv) : m_env(pEnv)
{
mdb_txn_begin(pEnv, NULL, 0, &m_txn);
}
@@ -66,11 +67,11 @@ public:
__forceinline operator MDB_txn*() const { return m_txn; }
- __forceinline bool commit()
+ __forceinline int commit()
{
- bool bRes = (mdb_txn_commit(m_txn) != MDB_MAP_FULL);
- m_txn = NULL;
- return bRes;
+ MDB_txn *tmp = m_txn;
+ m_txn = nullptr;
+ return mdb_txn_commit(tmp);
}
__forceinline void abort()
@@ -121,17 +122,20 @@ class cursor_ptr_ro
public:
__forceinline cursor_ptr_ro(MDB_cursor *cursor) : m_cursor(cursor)
{
- mdb_cursor_renew(mdb_cursor_txn(m_cursor), m_cursor); //--
+ mdb_cursor_renew(mdb_cursor_txn(m_cursor), m_cursor);
}
__forceinline operator MDB_cursor*() const { return m_cursor; }
};
#define MDB_CHECK(A,B) \
- switch(A) { \
+ switch (A) { \
case MDB_SUCCESS: break; \
case MDB_MAP_FULL: continue; \
default: return (B); }
+
+
+
#include "dbintf.h"
#include "resource.h"
#include "version.h"