summaryrefslogtreecommitdiff
path: root/plugins/Variables/src
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Variables/src')
-rw-r--r--plugins/Variables/src/contact.cpp27
-rw-r--r--plugins/Variables/src/parse_alias.cpp12
-rw-r--r--plugins/Variables/src/tokenregister.cpp3
3 files changed, 19 insertions, 23 deletions
diff --git a/plugins/Variables/src/contact.cpp b/plugins/Variables/src/contact.cpp
index 270ae015b8..8574cea41f 100644
--- a/plugins/Variables/src/contact.cpp
+++ b/plugins/Variables/src/contact.cpp
@@ -317,22 +317,21 @@ static int contactSettingChanged(WPARAM hContact, LPARAM lParam)
bool isUid = (((INT_PTR)uid != CALLSERVICE_NOTFOUND) && (uid != nullptr)) && (!strcmp(dbw->szSetting, uid));
mir_cslock lck(csContactCache);
- for (int i = 0; i < arContactCache.getCount(); i++) {
- CONTACTCE &cce = arContactCache[i];
- if (hContact != cce.hContact && (cce.flags & CI_CNFINFO) == 0)
+ for (auto &it : arContactCache) {
+ if (hContact != it->hContact && (it->flags & CI_CNFINFO) == 0)
continue;
- if ((isNick && (cce.flags & CI_NICK)) ||
- (isFirstName && (cce.flags & CI_FIRSTNAME)) ||
- (isLastName && (cce.flags & CI_LASTNAME)) ||
- (isEmail && (cce.flags & CI_EMAIL)) ||
- (isMyHandle && (cce.flags & CI_LISTNAME)) ||
- (cce.flags & CI_CNFINFO) != 0 || // lazy; always invalidate CNF info cache entries
- (isUid && (cce.flags & CI_UNIQUEID)))
+ if ((isNick && (it->flags & CI_NICK)) ||
+ (isFirstName && (it->flags & CI_FIRSTNAME)) ||
+ (isLastName && (it->flags & CI_LASTNAME)) ||
+ (isEmail && (it->flags & CI_EMAIL)) ||
+ (isMyHandle && (it->flags & CI_LISTNAME)) ||
+ (it->flags & CI_CNFINFO) != 0 || // lazy; always invalidate CNF info cache entries
+ (isUid && (it->flags & CI_UNIQUEID)))
{
/* remove from cache */
- mir_free(cce.tszContact);
- arContactCache.remove(i);
+ mir_free(it->tszContact);
+ arContactCache.remove(it);
break;
}
}
@@ -347,8 +346,8 @@ int initContactModule()
int deinitContactModule()
{
- for (int i = 0; i < arContactCache.getCount(); i++)
- mir_free(arContactCache[i].tszContact);
+ for (auto &it : arContactCache)
+ mir_free(it->tszContact);
arContactCache.destroy();
return 0;
}
diff --git a/plugins/Variables/src/parse_alias.cpp b/plugins/Variables/src/parse_alias.cpp
index e90595a68e..aff5f9251c 100644
--- a/plugins/Variables/src/parse_alias.cpp
+++ b/plugins/Variables/src/parse_alias.cpp
@@ -36,9 +36,9 @@ static ALIASREGISTER* searchAliasRegister(wchar_t *szAlias)
return nullptr;
mir_cslock lck(csAliasRegister);
- for (int i = 0; i < arAliases.getCount(); i++)
- if (!mir_wstrcmp(arAliases[i]->szAlias, szAlias))
- return arAliases[i];
+ for (auto &it : arAliases)
+ if (!mir_wstrcmp(it->szAlias, szAlias))
+ return it;
return nullptr;
}
@@ -93,8 +93,7 @@ static int addToAliasRegister(wchar_t *szAlias, unsigned int argc, wchar_t** arg
return -1;
mir_cslock lck(csAliasRegister);
- for (int i = 0; i < arAliases.getCount(); i++) {
- ALIASREGISTER *p = arAliases[i];
+ for (auto &p : arAliases) {
if (mir_wstrcmp(p->szAlias, szAlias))
continue;
@@ -194,8 +193,7 @@ void registerAliasTokens()
void unregisterAliasTokens()
{
- for (int i = 0; i < arAliases.getCount(); i++) {
- ALIASREGISTER *p = arAliases[i];
+ for (auto &p : arAliases) {
for (unsigned j = 0; j < p->argc; j++)
mir_free(p->argv[j]);
mir_free(p->argv);
diff --git a/plugins/Variables/src/tokenregister.cpp b/plugins/Variables/src/tokenregister.cpp
index 11c2212449..77c6af4252 100644
--- a/plugins/Variables/src/tokenregister.cpp
+++ b/plugins/Variables/src/tokenregister.cpp
@@ -238,8 +238,7 @@ int initTokenRegister()
int deinitTokenRegister()
{
- for (int i = 0; i < tokens.getCount(); i++) {
- TokenRegisterEntry *tre = tokens[i];
+ for (auto &tre : tokens) {
if (!(tre->tr.flags & TRF_PARSEFUNC) && tre->tr.szService != nullptr)
mir_free(tre->tr.szService);