From e1721a9474dc2906771e6c98ada72d41854ce5a9 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 17 Nov 2020 22:04:39 +0300 Subject: =?UTF-8?q?fixes=20#2569=20(=D0=9B=D0=BE=D0=BC=D0=B0=D0=B5=D1=82?= =?UTF-8?q?=D1=81=D1=8F=20=D0=BF=D1=80=D0=BE=D1=84=D0=B8=D0=BB=D1=8C=20?= =?UTF-8?q?=D0=BF=D0=BE=D1=81=D0=BB=D0=B5=20=D1=80=D0=B5=D0=B1=D1=83=D1=82?= =?UTF-8?q?=D0=B0=20=D0=BA=D0=BE=D0=BC=D0=BF=D0=B0.=20Miranda=20NG=20?= =?UTF-8?q?=D0=BD=D0=B5=20=D0=BC=D0=BE=D0=B6=D0=B5=D1=82=20=D0=BE=D1=82?= =?UTF-8?q?=D0=BA=D1=80=D1=8B=D1=82=D1=8C=20'*',=20=D0=BF=D1=80=D0=BE?= =?UTF-8?q?=D1=84=D0=B8=D0=BB=D1=8C=20=D0=B2=20=D0=BD=D0=B5=D0=B8=D0=B7?= =?UTF-8?q?=D0=B2=D0=B5=D1=81=D1=82=D0=BD=D0=BE=D0=BC=20=D1=84=D0=BE=D1=80?= =?UTF-8?q?=D0=BC=D0=B0=D1=82=D0=B5)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/Dbx_mdbx/src/stdafx.h | 56 +++++++++++++------------------------------ 1 file changed, 16 insertions(+), 40 deletions(-) (limited to 'plugins/Dbx_mdbx/src/stdafx.h') diff --git a/plugins/Dbx_mdbx/src/stdafx.h b/plugins/Dbx_mdbx/src/stdafx.h index 0dcad889ed..82e2e8be53 100644 --- a/plugins/Dbx_mdbx/src/stdafx.h +++ b/plugins/Dbx_mdbx/src/stdafx.h @@ -58,46 +58,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # define thread_local __declspec(thread) #endif -class txn_ptr -{ - MDBX_txn *txn; -public: - __forceinline txn_ptr(MDBX_txn *_txn) : - txn(_txn) - {} - - __forceinline ~txn_ptr() - { - if (txn) { - /* FIXME: see https://github.com/leo-yuriev/libfpta/blob/77a7251fde2030165a3916ee68fd86a1374b3dd8/src/common.cxx#L370 */ - Abort(); - } - } - - __forceinline operator MDBX_txn*() const { return txn; } - - __forceinline int Commit() - { - int rc = mdbx_txn_commit(txn); - if (rc != MDBX_SUCCESS) { - /* FIXME: throw an exception */ - Abort(); - return rc; - } - txn = nullptr; - return MDBX_SUCCESS; - } - - __forceinline void Abort() - { - int rc = mdbx_txn_abort(txn); - /* FIXME: throw an exception */ - _ASSERT(rc == MDBX_SUCCESS); - UNREFERENCED_PARAMETER(rc); - txn = nullptr; - } -}; - struct CMDBX_txn_ro { MDBX_txn *txn = nullptr; @@ -140,6 +100,22 @@ public: }; #include "dbintf.h" + +class txn_ptr +{ + CDbxMDBX *pDb; + MDBX_txn *txn; + +public: + txn_ptr(CDbxMDBX *_db); + ~txn_ptr(); + + __forceinline operator MDBX_txn*() const { return txn; } + + int Commit(); + void Abort(); +}; + #include "resource.h" #include "version.h" -- cgit v1.2.3