From 0c4bed1db819569b8d0e0e2e4cffdb070d221230 Mon Sep 17 00:00:00 2001 From: MikalaiR Date: Tue, 23 Feb 2016 17:52:24 +0000 Subject: small optimization git-svn-id: http://svn.miranda-ng.org/main/trunk@16330 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Dbx_mdb/src/dbcontacts.cpp | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) (limited to 'plugins') diff --git a/plugins/Dbx_mdb/src/dbcontacts.cpp b/plugins/Dbx_mdb/src/dbcontacts.cpp index aa5c8a6f9d..b59e69fe47 100644 --- a/plugins/Dbx_mdb/src/dbcontacts.cpp +++ b/plugins/Dbx_mdb/src/dbcontacts.cpp @@ -106,25 +106,12 @@ STDMETHODIMP_(LONG) CDbxMdb::DeleteContact(MCONTACT contactID) break; } { - LIST events(50, NumericKeySortT); - { - DBEventSortingKey keyVal = { 0, 0, contactID }; - key.mv_size = sizeof(keyVal); key.mv_data = &keyVal; - - txn_ptr_ro txn(m_txn); - cursor_ptr_ro cursor(m_curEventsSort); - mdb_cursor_get(cursor, &key, &data, MDB_SET); - while (mdb_cursor_get(cursor, &key, &data, MDB_NEXT) == MDB_SUCCESS) - { - DBEventSortingKey *pKey = (DBEventSortingKey*)key.mv_data; - if (pKey->dwContactId != contactID) - break; - events.insert((void*)pKey->dwEventId); - } - } + LIST events(50); + GatherContactHistory(contactID, events); while (events.getCount()) { - DeleteEvent(contactID, (MEVENT)events[0]); + DeleteEvent(contactID, events[0]->eventId); + delete events[0]; events.remove(0); } } -- cgit v1.2.3