diff options
author | George Hazan <george.hazan@gmail.com> | 2015-01-14 14:29:52 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-01-14 14:29:52 +0000 |
commit | e37f12dec252a78cdf94d31ccc87ce37c1436a1f (patch) | |
tree | 09d50f93a1f260e054908c775264819e82a0db48 /plugins/Dbx_mdb/src/dbmodulechain.cpp | |
parent | 5f4a6f00c20468e6adc3a7bf691eccef55d2324c (diff) |
txn_ptr & cursor_ptr classes
git-svn-id: http://svn.miranda-ng.org/main/trunk@11853 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Dbx_mdb/src/dbmodulechain.cpp')
-rw-r--r-- | plugins/Dbx_mdb/src/dbmodulechain.cpp | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/plugins/Dbx_mdb/src/dbmodulechain.cpp b/plugins/Dbx_mdb/src/dbmodulechain.cpp index a54d7ab2f9..1a78284d78 100644 --- a/plugins/Dbx_mdb/src/dbmodulechain.cpp +++ b/plugins/Dbx_mdb/src/dbmodulechain.cpp @@ -42,15 +42,14 @@ int CDbxMdb::InitModuleNames(void) {
m_maxModuleID = 0;
- txn_lock trnlck(m_pMdbEnv); + txn_ptr trnlck(m_pMdbEnv); mdb_open(trnlck, "modules", MDB_INTEGERKEY, &m_dbModules); - MDB_cursor *cursor; - if (mdb_cursor_open(trnlck, m_dbModules, &cursor) != MDB_SUCCESS) + cursor_ptr cursor(trnlck, m_dbModules); + if (!cursor) return 1; MDB_val key, data; - while (mdb_cursor_get(cursor, &key, &data, MDB_NEXT) == 0) { DBModuleName *pmod = (DBModuleName*)data.mv_data; if (pmod->signature != DBMODULENAME_SIGNATURE) @@ -66,8 +65,6 @@ int CDbxMdb::InitModuleNames(void) if (moduleId > m_maxModuleID)
m_maxModuleID = moduleId;
}
-
- mdb_cursor_close(cursor); return 0;
}
@@ -104,7 +101,7 @@ DWORD CDbxMdb::GetModuleNameOfs(const char *szName) MDB_val key = { sizeof(int), &newIdx }, data = { sizeof(DBModuleName) + nameLen, pmod }; for (;; Remap()) {
- txn_lock trnlck(m_pMdbEnv); + txn_ptr trnlck(m_pMdbEnv); mdb_open(trnlck, "modules", MDB_INTEGERKEY, &m_dbModules); mdb_put(trnlck, m_dbModules, &key, &data, 0);
if (trnlck.commit())
|