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/FavContacts | |
parent | 1a3f9ca88310cb9080a4c0073087bebc4c1e3a0a (diff) |
reverse iterators for LIST<>
Diffstat (limited to 'plugins/FavContacts')
-rw-r--r-- | plugins/FavContacts/src/contact_cache.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/plugins/FavContacts/src/contact_cache.cpp b/plugins/FavContacts/src/contact_cache.cpp index d60cd00d84..5ebd3f1c71 100644 --- a/plugins/FavContacts/src/contact_cache.cpp +++ b/plugins/FavContacts/src/contact_cache.cpp @@ -38,13 +38,12 @@ int __cdecl CContactCache::OnDbEventAdded(WPARAM hContact, LPARAM hEvent) TContactInfo *pFound = nullptr;
mir_cslock lck(m_cs);
- for (int i = m_cache.getCount()-1; i >= 0; i--) {
- TContactInfo *p = m_cache[i];
- p->rate *= q;
- if (p->hContact == hContact) {
- p->rate += weight;
- pFound = p;
- m_cache.remove(i); // reinsert to maintain the sort order
+ for (auto &it : m_cache.rev_iter()) {
+ it->rate *= q;
+ if (it->hContact == hContact) {
+ it->rate += weight;
+ pFound = it;
+ m_cache.remove(it); // reinsert to maintain the sort order
}
}
|