diff options
author | George Hazan <ghazan@miranda.im> | 2018-03-16 12:09:30 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-03-16 12:09:38 +0300 |
commit | a7e5e613f86963c8bf82248ab044e0ea36e42fbc (patch) | |
tree | 39e0e6b3ab4bcb55255302d3d1e989b31247bf7b /protocols/JabberG/src/jabber_list.cpp | |
parent | ecbca42677af470d672e66d3f6950af208f8f212 (diff) |
LIST<>::indexOf(T**) - fast index calculation for direct iterators
Diffstat (limited to 'protocols/JabberG/src/jabber_list.cpp')
-rw-r--r-- | protocols/JabberG/src/jabber_list.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/protocols/JabberG/src/jabber_list.cpp b/protocols/JabberG/src/jabber_list.cpp index 0d102bf196..8a4b817965 100644 --- a/protocols/JabberG/src/jabber_list.cpp +++ b/protocols/JabberG/src/jabber_list.cpp @@ -362,13 +362,11 @@ pResourceStatus JABBER_LIST_ITEM::getBestResource() const return m_pManualResource;
int nBestPos = -1, nBestPri = -200;
- for (int i = 0; i < arResources.getCount(); i++) {
- JABBER_RESOURCE_STATUS *r = arResources[i];
+ for (auto &r : arResources)
if (r->m_iPriority > nBestPri) {
nBestPri = r->m_iPriority;
- nBestPos = i;
+ nBestPos = arResources.indexOf(&r);
}
- }
return (nBestPos != -1) ? arResources[nBestPos] : nullptr;
}
|