diff options
author | MikalaiR <nikolay.romanovich@narod.ru> | 2016-02-18 12:32:59 +0000 |
---|---|---|
committer | MikalaiR <nikolay.romanovich@narod.ru> | 2016-02-18 12:32:59 +0000 |
commit | 2868202cb6260735157346833a4cf6326772011d (patch) | |
tree | 8bd251c1f657b3057975afee34055eba2c66f458 /plugins/Dbx_mdb/src/stdafx.h | |
parent | 73a0b84498501c1e2907f1cdc5f222f1f400edfd (diff) |
dbx_lmdb: speed optimization
git-svn-id: http://svn.miranda-ng.org/main/trunk@16301 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Dbx_mdb/src/stdafx.h')
-rw-r--r-- | plugins/Dbx_mdb/src/stdafx.h | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/plugins/Dbx_mdb/src/stdafx.h b/plugins/Dbx_mdb/src/stdafx.h index dd06f5806a..ee324a69ee 100644 --- a/plugins/Dbx_mdb/src/stdafx.h +++ b/plugins/Dbx_mdb/src/stdafx.h @@ -21,13 +21,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#define _CRT_SECURE_NO_WARNINGS
-#define _WIN32_WINNT 0x0501
-
-#pragma warning(disable:4509)
-
-//#define SIZEOF(x) _countof(x)
-
#include <windows.h>
#include <time.h>
#include <process.h>
@@ -83,12 +76,34 @@ public: }
};
+class txn_ptr_ro
+{
+ static MDB_txn *m_txn;
+
+public:
+ __forceinline txn_ptr_ro(MDB_env *pEnv)
+ {
+ if (!m_txn)
+ mdb_txn_begin(pEnv, NULL, MDB_RDONLY, &m_txn);
+ else
+ mdb_txn_renew(m_txn);
+ }
+
+ __forceinline ~txn_ptr_ro()
+ {
+ if (m_txn)
+ mdb_txn_reset(m_txn);
+ }
+
+ __forceinline operator MDB_txn*() const { return m_txn; }
+};
+
class cursor_ptr
{
MDB_cursor *m_cursor;
public:
- __forceinline cursor_ptr(const txn_ptr &_txn, MDB_dbi _dbi)
+ __forceinline cursor_ptr(MDB_txn *_txn, MDB_dbi _dbi)
{
if (mdb_cursor_open(_txn, _dbi, &m_cursor) != MDB_SUCCESS)
m_cursor = NULL;
|