diff options
author | George Hazan <ghazan@miranda.im> | 2018-02-21 18:36:16 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-02-21 18:40:14 +0300 |
commit | fd23a292afc4aa760a0ff8ab646eebe5942fb06d (patch) | |
tree | 31725237daf806abe7e7ab6f3fa637bc092c20ec /protocols/IcqOscarJ/src/utilities.cpp | |
parent | b8a1ac529c6615d5ba6aa3d7ea9e8b4fe9ad4b71 (diff) |
ICQ: C++'11 iterators
Diffstat (limited to 'protocols/IcqOscarJ/src/utilities.cpp')
-rw-r--r-- | protocols/IcqOscarJ/src/utilities.cpp | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/protocols/IcqOscarJ/src/utilities.cpp b/protocols/IcqOscarJ/src/utilities.cpp index 1a22839013..db1af286c9 100644 --- a/protocols/IcqOscarJ/src/utilities.cpp +++ b/protocols/IcqOscarJ/src/utilities.cpp @@ -373,11 +373,9 @@ void CIcqProto::UninitContactsCache(void) mir_cslock l(contactsCacheMutex);
// cleanup the cache
- for (int i = 0; i < contactsCache.getCount(); i++) {
- icq_contacts_cache *cache_item = contactsCache[i];
-
- SAFE_FREE((void**)&cache_item->szUid);
- SAFE_FREE((void**)&cache_item);
+ for (auto &it : contactsCache) {
+ SAFE_FREE((void**)&it->szUid);
+ SAFE_FREE((void**)&it);
}
contactsCache.destroy();
@@ -388,14 +386,12 @@ void CIcqProto::DeleteFromContactsCache(MCONTACT hContact) {
mir_cslock l(contactsCacheMutex);
- for (int i = 0; i < contactsCache.getCount(); i++) {
- icq_contacts_cache *cache_item = contactsCache[i];
-
- if (cache_item->hContact == hContact) {
- contactsCache.remove(i);
+ for (auto &it : contactsCache) {
+ if (it->hContact == hContact) {
+ contactsCache.remove(it);
// Release memory
- SAFE_FREE((void**)&cache_item->szUid);
- SAFE_FREE((void**)&cache_item);
+ SAFE_FREE((void**)&it->szUid);
+ SAFE_FREE((void**)&it);
break;
}
}
|