diff options
author | George Hazan <ghazan@miranda.im> | 2018-03-16 12:09:30 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-03-16 12:09:38 +0300 |
commit | a7e5e613f86963c8bf82248ab044e0ea36e42fbc (patch) | |
tree | 39e0e6b3ab4bcb55255302d3d1e989b31247bf7b /plugins/Clist_nicer | |
parent | ecbca42677af470d672e66d3f6950af208f8f212 (diff) |
LIST<>::indexOf(T**) - fast index calculation for direct iterators
Diffstat (limited to 'plugins/Clist_nicer')
-rw-r--r-- | plugins/Clist_nicer/src/clistevents.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/plugins/Clist_nicer/src/clistevents.cpp b/plugins/Clist_nicer/src/clistevents.cpp index 288d55cdcc..d9856cec30 100644 --- a/plugins/Clist_nicer/src/clistevents.cpp +++ b/plugins/Clist_nicer/src/clistevents.cpp @@ -315,19 +315,19 @@ CListEvent* AddEvent(CLISTEVENT *cle) int RemoveEvent(MCONTACT hContact, MEVENT hDbEvent)
{
// Find the event that should be removed
- int i;
- for (i = 0; i < pcli->events->getCount(); i++) {
- CListEvent &e = (*pcli->events)[i];
- if (e.hContact == hContact && e.hDbEvent == hDbEvent)
+ CListEvent *e = nullptr;
+ for (auto &it : *pcli->events)
+ if (it->hContact == hContact && it->hDbEvent == hDbEvent) {
+ e = it;
break;
- }
+ }
// Event was not found
- if (i == pcli->events->getCount())
+ if (e == nullptr)
return 1;
// remove event from the notify menu
- int iMenuId = (*pcli->events)[i].menuId;
+ int iMenuId = e->menuId;
if (iMenuId > 0) {
MENUITEMINFO mii = { 0 };
mii.cbSize = sizeof(mii);
|