diff options
author | MikalaiR <nikolay.romanovich@narod.ru> | 2016-07-03 17:19:54 +0000 |
---|---|---|
committer | MikalaiR <nikolay.romanovich@narod.ru> | 2016-07-03 17:19:54 +0000 |
commit | ed204fe350540966e492859c9f9c734b6b9f1cde (patch) | |
tree | 33be33ad2c5e903ca037fdeef82e1e4b2a9a4b62 /plugins/Dbx_mdb/src/dbcontacts.cpp | |
parent | be556ddb9cca86b4242781761019da7ba6a537d0 (diff) |
dbx_lmdb: code optimization
git-svn-id: http://svn.miranda-ng.org/main/trunk@17057 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Dbx_mdb/src/dbcontacts.cpp')
-rw-r--r-- | plugins/Dbx_mdb/src/dbcontacts.cpp | 29 |
1 files changed, 9 insertions, 20 deletions
diff --git a/plugins/Dbx_mdb/src/dbcontacts.cpp b/plugins/Dbx_mdb/src/dbcontacts.cpp index 2645a12db2..629790ea61 100644 --- a/plugins/Dbx_mdb/src/dbcontacts.cpp +++ b/plugins/Dbx_mdb/src/dbcontacts.cpp @@ -286,12 +286,12 @@ void DBCachedContact::Advance(DWORD id, DBEvent &dbe) void DBCachedContact::Snapshot()
{
- memcpy(&tmp_dbc, &dbc, sizeof(dbc));
+ tmp_dbc = dbc;
}
void DBCachedContact::Revert()
{
- memcpy(&dbc, &tmp_dbc, sizeof(dbc));
+ dbc = tmp_dbc;
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -301,26 +301,15 @@ void CDbxMdb::FillContacts() {
LIST<DBCachedContact> arContacts(m_contactCount);
- {
- txn_ptr_ro trnlck(m_txn);
- cursor_ptr_ro cursor(m_curContacts);
-
- MDB_val key, data;
- while (mdb_cursor_get(cursor, &key, &data, MDB_NEXT) == MDB_SUCCESS)
- {
- const DBContact *dbc = (const DBContact*)data.mv_data;
-
- DBCachedContact *cc = m_cache->AddContactToCache(*(MCONTACT*)key.mv_data);
- cc->dbc.dwEventCount = dbc->dwEventCount;
- cc->dbc.dwFirstUnread = dbc->dwFirstUnread;
- cc->dbc.tsFirstUnread = dbc->tsFirstUnread;
- arContacts.insert(cc);
- }
- }
+ txn_ptr_ro trnlck(m_txn);
+ cursor_ptr_ro cursor(m_curContacts);
- for (int i = 0; i < arContacts.getCount(); i++)
+ MDB_val key, data;
+ while (mdb_cursor_get(cursor, &key, &data, MDB_NEXT) == MDB_SUCCESS)
{
- DBCachedContact *cc = arContacts[i];
+ DBCachedContact *cc = m_cache->AddContactToCache(*(MCONTACT*)key.mv_data);
+ cc->dbc = *(DBContact*)data.mv_data;
+
CheckProto(cc, "");
DBVARIANT dbv; dbv.type = DBVT_DWORD;
|