summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2020-01-30 20:18:37 +0300
committerGeorge Hazan <ghazan@miranda.im>2020-01-30 20:18:46 +0300
commit4c281b28075dfa69d8cc2301b06492fbddb62f24 (patch)
treeb788f37caaff5063fd36eecad191d2a5582be12c /src
parenta243c59835182e2a1fa91d9c7bd80defea88e4e8 (diff)
LIST::remove + LIST::indexOf() combination removed with LIST::removeItem
Diffstat (limited to 'src')
-rw-r--r--src/core/stdmsg/src/cmdlist.cpp6
-rw-r--r--src/core/stduserinfo/src/userinfo.cpp2
-rw-r--r--src/mir_app/src/FontOptions.cpp18
-rw-r--r--src/mir_app/src/chat_manager.cpp6
-rw-r--r--src/mir_app/src/clistgroups.cpp2
-rw-r--r--src/mir_app/src/ei_services.cpp5
-rw-r--r--src/mir_app/src/hotkey_opts.cpp13
-rw-r--r--src/mir_app/src/hotkeys.cpp18
-rw-r--r--src/mir_app/src/icolib.cpp9
-rw-r--r--src/mir_app/src/proto_accs.cpp4
-rw-r--r--src/mir_app/src/sounds.cpp2
-rw-r--r--src/mir_app/src/srmm_statusicon.cpp5
-rw-r--r--src/mir_app/src/srmm_toolbar.cpp22
-rw-r--r--src/mir_app/src/usedIcons.cpp5
-rw-r--r--src/mir_core/src/threads.cpp2
15 files changed, 48 insertions, 71 deletions
diff --git a/src/core/stdmsg/src/cmdlist.cpp b/src/core/stdmsg/src/cmdlist.cpp
index 0604b5269d..35fbcac30a 100644
--- a/src/core/stdmsg/src/cmdlist.cpp
+++ b/src/core/stdmsg/src/cmdlist.cpp
@@ -32,11 +32,11 @@ static VOID CALLBACK MsgTimer(HWND, UINT, UINT_PTR, DWORD dwTime)
LIST<TMsgQueue> arTimedOut(1);
{
mir_cslock lck(csMsgQueue);
- auto T = msgQueue.rev_iter();
- for (auto &it : T)
+
+ for (auto &it : msgQueue.rev_iter())
if (dwTime - it->ts > g_dat.msgTimeout) {
arTimedOut.insert(it);
- msgQueue.remove(T.indexOf(&it));
+ msgQueue.removeItem(&it);
}
}
diff --git a/src/core/stduserinfo/src/userinfo.cpp b/src/core/stduserinfo/src/userinfo.cpp
index 52ea9dc7e9..dcb7d77f3c 100644
--- a/src/core/stduserinfo/src/userinfo.cpp
+++ b/src/core/stduserinfo/src/userinfo.cpp
@@ -383,7 +383,7 @@ public:
m_tree.DeleteAllItems();
bRemoved = true;
}
- m_pages.remove(m_pages.indexOf(&odp));
+ m_pages.removeItem(&odp);
}
}
diff --git a/src/mir_app/src/FontOptions.cpp b/src/mir_app/src/FontOptions.cpp
index 0d3b3a8d24..b818058378 100644
--- a/src/mir_app/src/FontOptions.cpp
+++ b/src/mir_app/src/FontOptions.cpp
@@ -87,51 +87,51 @@ MIR_APP_DLL(void) KillModuleFonts(HPLUGIN pPlugin)
{
for (auto &it : font_id_list.rev_iter())
if (it->pPlugin == pPlugin) {
- font_id_list.remove(font_id_list.indexOf(&it));
+ font_id_list.removeItem(&it);
notifyOptions();
}
for (auto &it : font_id_list_w2.rev_iter())
if (it->pPlugin == pPlugin)
- font_id_list_w2.remove(font_id_list_w2.indexOf(&it));
+ font_id_list_w2.removeItem(&it);
for (auto &it : font_id_list_w3.rev_iter())
if (it->pPlugin == pPlugin)
- font_id_list_w3.remove(font_id_list_w3.indexOf(&it));
+ font_id_list_w3.removeItem(&it);
}
MIR_APP_DLL(void) KillModuleColours(HPLUGIN pPlugin)
{
for (auto &it : colour_id_list.rev_iter())
if (it->pPlugin == pPlugin) {
- colour_id_list.remove(colour_id_list.indexOf(&it));
+ colour_id_list.removeItem(&it);
notifyOptions();
}
for (auto &it : colour_id_list_w2.rev_iter())
if (it->pPlugin == pPlugin)
- colour_id_list_w2.remove(colour_id_list_w2.indexOf(&it));
+ colour_id_list_w2.removeItem(&it);
for (auto &it : colour_id_list_w3.rev_iter())
if (it->pPlugin == pPlugin)
- colour_id_list_w3.remove(colour_id_list_w3.indexOf(&it));
+ colour_id_list_w3.removeItem(&it);
}
MIR_APP_DLL(void) KillModuleEffects(HPLUGIN pPlugin)
{
for (auto &it : effect_id_list.rev_iter())
if (it->pPlugin == pPlugin) {
- effect_id_list.remove(effect_id_list.indexOf(&it));
+ effect_id_list.removeItem(&it);
notifyOptions();
}
for (auto &it : effect_id_list_w2.rev_iter())
if (it->pPlugin == pPlugin)
- effect_id_list_w2.remove(effect_id_list_w2.indexOf(&it));
+ effect_id_list_w2.removeItem(&it);
for (auto &it : effect_id_list_w3.rev_iter())
if (it->pPlugin == pPlugin)
- effect_id_list_w3.remove(effect_id_list_w3.indexOf(&it));
+ effect_id_list_w3.removeItem(&it);
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/mir_app/src/chat_manager.cpp b/src/mir_app/src/chat_manager.cpp
index 381a1c5679..e1b1627741 100644
--- a/src/mir_app/src/chat_manager.cpp
+++ b/src/mir_app/src/chat_manager.cpp
@@ -211,7 +211,7 @@ int SM_RemoveSession(const wchar_t *pszID, const char *pszModule, bool removeCon
for (auto &si : T) {
if (si->iType != GCW_SERVER && !mir_strcmpi(si->pszModule, pszModule)) {
SM_FreeSession(si, removeContact);
- g_arSessions.remove(T.indexOf(&si));
+ g_arSessions.removeItem(&si);
}
}
return TRUE;
@@ -428,7 +428,7 @@ void SM_RemoveAll(void)
{
for (auto &it : g_arSessions.rev_iter()) {
SM_FreeSession(it, false);
- g_arSessions.remove(g_arSessions.indexOf(&it));
+ g_arSessions.removeItem(&it);
}
}
@@ -821,7 +821,7 @@ static BOOL UM_RemoveUser(SESSION_INFO *si, const wchar_t *pszUID)
if (!mir_wstrcmpi(ui->pszUID, pszUID)) {
mir_free(ui->pszNick);
mir_free(ui->pszUID);
- arUsers.remove(arUsers.indexOf(&ui));
+ arUsers.removeItem(&ui);
break;
}
}
diff --git a/src/mir_app/src/clistgroups.cpp b/src/mir_app/src/clistgroups.cpp
index 76a0ed70b8..51b6ecd4c0 100644
--- a/src/mir_app/src/clistgroups.cpp
+++ b/src/mir_app/src/clistgroups.cpp
@@ -239,7 +239,7 @@ MIR_APP_DLL(int) Clist_GroupDelete(MGROUP hGroup)
iGap++;
arByName.remove(it);
- arByIds.remove(arByIds.indexOf(&it));
+ arByIds.removeItem(&it);
}
for (auto &it : arByIds) {
diff --git a/src/mir_app/src/ei_services.cpp b/src/mir_app/src/ei_services.cpp
index 32c9107cf8..94b8777c60 100644
--- a/src/mir_app/src/ei_services.cpp
+++ b/src/mir_app/src/ei_services.cpp
@@ -193,11 +193,10 @@ MIR_APP_DLL(void) KillModuleExtraIcons(HPLUGIN pPlugin)
{
LIST<ExtraIcon> arIcons(1);
- auto T = registeredExtraIcons.rev_iter();
- for (auto &it : T)
+ for (auto &it : registeredExtraIcons.rev_iter())
if (it->m_pPlugin == pPlugin) {
arIcons.insert(it);
- registeredExtraIcons.remove(T.indexOf(&it));
+ registeredExtraIcons.removeItem(&it);
}
if (arIcons.getCount() == 0)
diff --git a/src/mir_app/src/hotkey_opts.cpp b/src/mir_app/src/hotkey_opts.cpp
index ada51dcfea..c361d7c7ef 100644
--- a/src/mir_app/src/hotkey_opts.cpp
+++ b/src/mir_app/src/hotkey_opts.cpp
@@ -754,15 +754,10 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam,
break;
UnregisterHotkeys();
- {
- auto T = hotkeys.rev_iter();
- for (auto &p : T) {
- if (p->OptNew && p->OptDeleted || p->rootHotkey && !p->OptHotkey || (lpnmhdr->code == PSN_APPLY) && p->OptDeleted || (lpnmhdr->code == PSN_RESET) && p->OptNew) {
- FreeHotkey(p);
- hotkeys.remove(T.indexOf(&p));
- }
- }
- }
+
+ for (auto &p : hotkeys.rev_iter())
+ if (p->OptNew && p->OptDeleted || p->rootHotkey && !p->OptHotkey || (lpnmhdr->code == PSN_APPLY) && p->OptDeleted || (lpnmhdr->code == PSN_RESET) && p->OptNew)
+ FreeHotkey(hotkeys.removeItem(&p));
if (lpnmhdr->code == PSN_APPLY) {
LVITEM lvi = { 0 };
diff --git a/src/mir_app/src/hotkeys.cpp b/src/mir_app/src/hotkeys.cpp
index 7d7490e0c2..981dee4105 100644
--- a/src/mir_app/src/hotkeys.cpp
+++ b/src/mir_app/src/hotkeys.cpp
@@ -220,12 +220,9 @@ MIR_APP_DLL(int) Hotkey_Unregister(const char *pszName)
if (g_hwndHkOptions)
SendMessage(g_hwndHkOptions, WM_HOTKEYUNREGISTERED, 0, 0);
- auto T = hotkeys.rev_iter();
- for (auto &it : T)
- if (it->UnregisterHotkey) {
- FreeHotkey(it);
- hotkeys.remove(T.indexOf(&it));
- }
+ for (auto &it : hotkeys.rev_iter())
+ if (it->UnregisterHotkey)
+ FreeHotkey(hotkeys.removeItem(&it));
return 0;
}
@@ -288,12 +285,9 @@ void RegisterHotkeys()
MIR_APP_DLL(void) KillModuleHotkeys(HPLUGIN pPlugin)
{
- auto T = hotkeys.rev_iter();
- for (auto &it : T)
- if (it->pPlugin == pPlugin) {
- FreeHotkey(it);
- hotkeys.remove(T.indexOf(&it));
- }
+ for (auto &it : hotkeys.rev_iter())
+ if (it->pPlugin == pPlugin)
+ FreeHotkey(hotkeys.removeItem(&it));
}
void UnregisterHotkeys()
diff --git a/src/mir_app/src/icolib.cpp b/src/mir_app/src/icolib.cpp
index 308961343e..54452dc550 100644
--- a/src/mir_app/src/icolib.cpp
+++ b/src/mir_app/src/icolib.cpp
@@ -613,12 +613,9 @@ MIR_APP_DLL(void) KillModuleIcons(HPLUGIN pPlugin)
return;
mir_cslock lck(csIconList);
- auto T = iconList.rev_iter();
- for (auto &it : T)
- if (it->pPlugin == pPlugin) {
- delete it;
- iconList.remove(T.indexOf(&it));
- }
+ for (auto &it : iconList.rev_iter())
+ if (it->pPlugin == pPlugin)
+ delete iconList.removeItem(&it);
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/mir_app/src/proto_accs.cpp b/src/mir_app/src/proto_accs.cpp
index fa91049dca..e3fe8d0f3c 100644
--- a/src/mir_app/src/proto_accs.cpp
+++ b/src/mir_app/src/proto_accs.cpp
@@ -373,7 +373,7 @@ void KillModuleAccounts(HINSTANCE hInst)
}
}
- g_arProtos.remove(g_arProtos.indexOf(&pd));
+ g_arProtos.removeItem(&pd);
}
}
@@ -418,7 +418,7 @@ void UnloadAccountsModule()
auto T = accounts.rev_iter();
for (auto &it : T) {
UnloadAccount(it, 0);
- accounts.remove(T.indexOf(&it));
+ accounts.removeItem(&it);
}
accounts.destroy();
diff --git a/src/mir_app/src/sounds.cpp b/src/mir_app/src/sounds.cpp
index 9eb1937d3e..64d7a58a6f 100644
--- a/src/mir_app/src/sounds.cpp
+++ b/src/mir_app/src/sounds.cpp
@@ -371,7 +371,7 @@ MIR_APP_DLL(void) KillModuleSounds(HPLUGIN pPlugin)
auto T = arSounds.rev_iter();
for (auto &it : T)
if (it->pPlugin == pPlugin) {
- arSounds.remove(T.indexOf(&it));
+ arSounds.removeItem(&it);
bFound = true;
}
diff --git a/src/mir_app/src/srmm_statusicon.cpp b/src/mir_app/src/srmm_statusicon.cpp
index 3f17e76e0e..bfb9bc3ee6 100644
--- a/src/mir_app/src/srmm_statusicon.cpp
+++ b/src/mir_app/src/srmm_statusicon.cpp
@@ -256,10 +256,9 @@ MIR_APP_DLL(void) Srmm_ClickStatusIcon(MCONTACT hContact, const StatusIconClickD
void KillModuleSrmmIcons(HPLUGIN pPlugin)
{
- auto T = arIcons.rev_iter();
- for (auto &it : T)
+ for (auto &it : arIcons.rev_iter())
if (it->pPlugin == pPlugin)
- arIcons.remove(T.indexOf(&it));
+ arIcons.removeItem(&it);
}
int LoadSrmmModule()
diff --git a/src/mir_app/src/srmm_toolbar.cpp b/src/mir_app/src/srmm_toolbar.cpp
index 33d10bbd28..5aa899f31b 100644
--- a/src/mir_app/src/srmm_toolbar.cpp
+++ b/src/mir_app/src/srmm_toolbar.cpp
@@ -222,12 +222,9 @@ MIR_APP_DLL(int) Srmm_RemoveButton(BBButton *bbdi)
{
mir_cslock lck(csToolBar);
- auto T = arButtonsList.rev_iter();
- for (auto &cbd : T)
- if (!mir_strcmp(cbd->m_pszModuleName, bbdi->pszModuleName) && cbd->m_dwButtonID == bbdi->dwButtonID) {
- pFound = cbd;
- arButtonsList.remove(T.indexOf(&cbd));
- }
+ for (auto &cbd : arButtonsList.rev_iter())
+ if (!mir_strcmp(cbd->m_pszModuleName, bbdi->pszModuleName) && cbd->m_dwButtonID == bbdi->dwButtonID)
+ pFound = arButtonsList.removeItem(&cbd);
}
if (pFound) {
@@ -425,15 +422,14 @@ MIR_APP_DLL(void) Srmm_RedrawToolbarIcons(HWND hwndDlg)
static void CB_ReInitCustomButtons()
{
- auto T = arButtonsList.rev_iter();
- for (auto &cbd : T) {
+ for (auto &cbd : arButtonsList.rev_iter())
if (cbd->m_opFlags & (BBSF_NTBSWAPED | BBSF_NTBDESTRUCT)) {
cbd->m_opFlags ^= BBSF_NTBSWAPED;
if (cbd->m_opFlags & BBSF_NTBDESTRUCT)
- arButtonsList.remove(T.indexOf(&cbd));
+ arButtonsList.removeItem(&cbd);
}
- }
+
qsort(arButtonsList.getArray(), arButtonsList.getCount(), sizeof(void*), sstSortButtons);
WindowList_Broadcast(g_hWindowList, WM_CBD_RECREATE, 0, 0);
@@ -791,10 +787,8 @@ void KillModuleToolbarIcons(HPLUGIN pPlugin)
{
auto T = arButtonsList.rev_iter();
for (auto &cbd : T)
- if (cbd->m_pPlugin == pPlugin) {
- delete cbd;
- arButtonsList.remove(T.indexOf(&cbd));
- }
+ if (cbd->m_pPlugin == pPlugin)
+ delete arButtonsList.removeItem(&cbd);
}
static INT_PTR BroadcastMessage(WPARAM, LPARAM lParam)
diff --git a/src/mir_app/src/usedIcons.cpp b/src/mir_app/src/usedIcons.cpp
index b904a091bd..5673637c1a 100644
--- a/src/mir_app/src/usedIcons.cpp
+++ b/src/mir_app/src/usedIcons.cpp
@@ -84,10 +84,9 @@ void RemoveIcon(const char *icolibName)
void ResetIcons()
{
- auto T = usedIcons.rev_iter();
- for (auto &it : T) {
+ for (auto &it : usedIcons.rev_iter()) {
if (it->refCount <= 0)
- usedIcons.remove(T.indexOf(&it));
+ usedIcons.removeItem(&it);
else
it->hImage = INVALID_HANDLE_VALUE;
}
diff --git a/src/mir_core/src/threads.cpp b/src/mir_core/src/threads.cpp
index ad14b1cc9f..27e33dfa90 100644
--- a/src/mir_core/src/threads.cpp
+++ b/src/mir_core/src/threads.cpp
@@ -239,7 +239,7 @@ static void __cdecl KillObjectThreadsWorker(void* owner)
TerminateThread(it->hThread, 9999);
CloseHandle(it->hThread);
mir_free(it);
- threads.remove(T.indexOf(&it));
+ threads.removeItem(&it);
}
}
}