From df6b0c988eb26339d4c7e4a1d0fe3b9717703c28 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 9 Mar 2018 19:32:32 +0300 Subject: more loop-related code cleaning --- src/core/stdmsg/src/cmdlist.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/core/stdmsg') diff --git a/src/core/stdmsg/src/cmdlist.cpp b/src/core/stdmsg/src/cmdlist.cpp index 32e6049de4..3b44e921c9 100644 --- a/src/core/stdmsg/src/cmdlist.cpp +++ b/src/core/stdmsg/src/cmdlist.cpp @@ -65,17 +65,16 @@ TMsgQueue* msgQueue_find(MCONTACT hContact, int id) MCONTACT hMeta = db_mc_getMeta(hContact); mir_cslockfull lck(csMsgQueue); - for (int i = 0; i < msgQueue.getCount(); i++) { - TMsgQueue *item = msgQueue[i]; - if ((item->hContact == hContact || item->hContact == hMeta) && item->id == id) { - msgQueue.remove(i); + for (auto &it : msgQueue) { + if ((it->hContact == hContact || it->hContact == hMeta) && it->id == id) { + msgQueue.remove(it); if (!msgQueue.getCount() && timerId) { KillTimer(nullptr, timerId); timerId = 0; } - return item; + return it; } } return nullptr; -- cgit v1.2.3