diff options
author | George Hazan <ghazan@miranda.im> | 2018-03-14 19:59:06 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-03-14 19:59:06 +0300 |
commit | dad59528ccd770301b29c7db8148ff8ab8e89c92 (patch) | |
tree | b93aa1b9149ddf20d6317d44cf924be8d0be276a /plugins/UserInfoEx/src | |
parent | 1a3f9ca88310cb9080a4c0073087bebc4c1e3a0a (diff) |
reverse iterators for LIST<>
Diffstat (limited to 'plugins/UserInfoEx/src')
-rw-r--r-- | plugins/UserInfoEx/src/mir_contactqueue.cpp | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/plugins/UserInfoEx/src/mir_contactqueue.cpp b/plugins/UserInfoEx/src/mir_contactqueue.cpp index 9a734ba968..752a9fbbc5 100644 --- a/plugins/UserInfoEx/src/mir_contactqueue.cpp +++ b/plugins/UserInfoEx/src/mir_contactqueue.cpp @@ -71,8 +71,8 @@ void CContactQueue::RemoveAll() {
mir_cslock lck(_cs);
- for (int i = _queue.getCount() - 1; i >= 0; --i)
- mir_free(_queue[i]);
+ for (auto &it : _queue)
+ mir_free(it);
_queue.destroy();
}
@@ -83,10 +83,9 @@ void CContactQueue::RemoveAll(MCONTACT hContact) {
mir_cslock lck(_cs);
- for (int i = _queue.getCount() - 1; i >= 0; --i) {
- CQueueItem *qi = _queue[i];
+ for (auto &qi : _queue.rev_iter()) {
if (qi->hContact == hContact) {
- _queue.remove(i);
+ _queue.remove(qi);
mir_free(qi);
}
}
@@ -99,13 +98,11 @@ void CContactQueue::RemoveAllConsiderParam(MCONTACT hContact, PVOID param) {
mir_cslock lck(_cs);
- for (int i = _queue.getCount() - 1; i >= 0; --i) {
- CQueueItem *qi = _queue[i];
+ for (auto &qi : _queue.rev_iter())
if (qi->hContact == hContact && qi->param == param) {
- _queue.remove(i);
+ _queue.remove(qi);
mir_free(qi);
}
- }
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -125,8 +122,8 @@ BOOL CContactQueue::AddIfDontHave(int waitTime, MCONTACT hContact, PVOID param) {
mir_cslock lck(_cs);
- for (int i = _queue.getCount() - 1; i >= 0; --i)
- if (_queue[i]->hContact == hContact)
+ for (auto &qi : _queue.rev_iter())
+ if (qi->hContact == hContact)
return FALSE;
return InternalAdd(waitTime, hContact, param);
|