summaryrefslogtreecommitdiff
path: root/plugins/Clist_modern
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-03-16 12:09:30 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-03-16 12:09:38 +0300
commita7e5e613f86963c8bf82248ab044e0ea36e42fbc (patch)
tree39e0e6b3ab4bcb55255302d3d1e989b31247bf7b /plugins/Clist_modern
parentecbca42677af470d672e66d3f6950af208f8f212 (diff)
LIST<>::indexOf(T**) - fast index calculation for direct iterators
Diffstat (limited to 'plugins/Clist_modern')
-rw-r--r--plugins/Clist_modern/src/modern_clistevents.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/plugins/Clist_modern/src/modern_clistevents.cpp b/plugins/Clist_modern/src/modern_clistevents.cpp
index 0caf90b0d7..a336f326f9 100644
--- a/plugins/Clist_modern/src/modern_clistevents.cpp
+++ b/plugins/Clist_modern/src/modern_clistevents.cpp
@@ -158,19 +158,19 @@ CListEvent* cli_AddEvent(CLISTEVENT *cle)
int cli_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 *pEvent = nullptr;
+ for (auto &it : *pcli->events)
+ if (it->hContact == hContact && it->hDbEvent == hDbEvent) {
+ pEvent = it;
break;
- }
+ }
// Event was not found
- if (i == pcli->events->getCount())
+ if (pEvent == nullptr)
return 1;
// remove event from the notify menu
- int iMenuId = (*pcli->events)[i].menuId;
+ int iMenuId = pEvent->menuId;
if (iMenuId > 0) {
MENUITEMINFO mii = { 0 };
mii.cbSize = sizeof(mii);