summaryrefslogtreecommitdiff
path: root/plugins/NewXstatusNotify/src/xstatus.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-03-14 19:59:06 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-03-14 19:59:06 +0300
commitdad59528ccd770301b29c7db8148ff8ab8e89c92 (patch)
treeb93aa1b9149ddf20d6317d44cf924be8d0be276a /plugins/NewXstatusNotify/src/xstatus.cpp
parent1a3f9ca88310cb9080a4c0073087bebc4c1e3a0a (diff)
reverse iterators for LIST<>
Diffstat (limited to 'plugins/NewXstatusNotify/src/xstatus.cpp')
-rw-r--r--plugins/NewXstatusNotify/src/xstatus.cpp36
1 files changed, 15 insertions, 21 deletions
diff --git a/plugins/NewXstatusNotify/src/xstatus.cpp b/plugins/NewXstatusNotify/src/xstatus.cpp
index a3cacaecb0..a582c8e5c7 100644
--- a/plugins/NewXstatusNotify/src/xstatus.cpp
+++ b/plugins/NewXstatusNotify/src/xstatus.cpp
@@ -42,38 +42,32 @@ void FreeXSC(XSTATUSCHANGE *xsc)
void RemoveLoggedEventsXStatus(MCONTACT hContact)
{
- for (int i = eventListXStatus.getCount() - 1; i >= 0; i--) {
- DBEVENT *dbevent = eventListXStatus[i];
- if (dbevent->hContact == hContact) {
- db_event_delete(dbevent->hContact, dbevent->hDBEvent);
- eventListXStatus.remove(i);
- mir_free(dbevent);
+ for (auto &it : eventListXStatus.rev_iter())
+ if (it->hContact == hContact) {
+ db_event_delete(it->hContact, it->hDBEvent);
+ eventListXStatus.remove(it);
+ mir_free(it);
}
- }
}
void RemoveLoggedEventsStatus(MCONTACT hContact)
{
- for (int i = eventListStatus.getCount() - 1; i >= 0; i--) {
- DBEVENT *dbevent = eventListStatus[i];
- if (dbevent->hContact == hContact) {
- db_event_delete(dbevent->hContact, dbevent->hDBEvent);
- eventListStatus.remove(i);
- mir_free(dbevent);
+ for (auto &it : eventListStatus.rev_iter())
+ if (it->hContact == hContact) {
+ db_event_delete(it->hContact, it->hDBEvent);
+ eventListStatus.remove(it);
+ mir_free(it);
}
- }
}
void RemoveLoggedEventsSMsg(MCONTACT hContact)
{
- for (int i = eventListSMsg.getCount() - 1; i >= 0; i--) {
- DBEVENT *dbevent = eventListSMsg[i];
- if (dbevent->hContact == hContact) {
- db_event_delete(dbevent->hContact, dbevent->hDBEvent);
- eventListSMsg.remove(i);
- mir_free(dbevent);
+ for (auto &it : eventListSMsg.rev_iter())
+ if (it->hContact == hContact) {
+ db_event_delete(it->hContact, it->hDBEvent);
+ eventListSMsg.remove(it);
+ mir_free(it);
}
- }
}
wchar_t* GetStatusTypeAsString(int type, wchar_t *buff)