From 34b2dde776b332116d04cea356843b324ab099fb Mon Sep 17 00:00:00 2001 From: attilamolnar Date: Sun, 1 Jul 2012 20:05:40 +0200 Subject: m_callerid Use std::find() where possible --- src/modules/m_callerid.cpp | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) (limited to 'src/modules') diff --git a/src/modules/m_callerid.cpp b/src/modules/m_callerid.cpp index c541f806b..44fe5f9e6 100644 --- a/src/modules/m_callerid.cpp +++ b/src/modules/m_callerid.cpp @@ -118,14 +118,9 @@ struct CallerIDExtInfo : public ExtensionItem if (!targ) continue; // shouldn't happen, but oh well. - for (std::list::iterator it2 = targ->wholistsme.begin(); it2 != targ->wholistsme.end(); it2++) - { - if (*it2 == dat) - { - targ->wholistsme.erase(it2); - break; - } - } + std::list::iterator it2 = std::find(targ->wholistsme.begin(), targ->wholistsme.end(), dat); + if (it2 != targ->wholistsme.end()) + targ->wholistsme.erase(it2); } } }; @@ -300,15 +295,10 @@ public: return false; } - for (std::list::iterator it = dat2->wholistsme.begin(); it != dat2->wholistsme.end(); it++) - { + std::list::iterator it = std::find(dat2->wholistsme.begin(), dat2->wholistsme.end(), dat); + if (it != dat2->wholistsme.end()) // Found me! - if (*it == dat) - { - dat2->wholistsme.erase(it); - break; - } - } + dat2->wholistsme.erase(it); user->WriteServ("NOTICE %s :%s is no longer on your accept list", user->nick.c_str(), whotoremove->nick.c_str()); return true; -- cgit v1.2.3