From 03f3e348e4542f60bbb6441aed7778374efa95ea Mon Sep 17 00:00:00 2001 From: psychon Date: Sat, 17 Oct 2009 15:50:58 +0000 Subject: [PATCH] Micro-optimization: Use existing functions in CModule::RemTimer() CModule::RemTimer(const CString& sLabel) now uses FindTimer() and RemTimer(CTimer *) to do the work instead of doing all of this by itself. Thanks to KiNgMaR again. git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1651 726aef4b-f618-498e-8847-2d620e286838 --- Modules.cpp | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/Modules.cpp b/Modules.cpp index 37c90b97..df89a7aa 100644 --- a/Modules.cpp +++ b/Modules.cpp @@ -333,18 +333,10 @@ bool CModule::RemTimer(CTimer* pTimer) { } bool CModule::RemTimer(const CString& sLabel) { - set::iterator it; - for (it = m_sTimers.begin(); it != m_sTimers.end(); ++it) { - CTimer* pTimer = *it; - - if (pTimer->GetName().Equals(sLabel)) { - m_sTimers.erase(it); - m_pManager->DelCronByAddr(pTimer); - return true; - } - } - - return false; + CTimer *pTimer = FindTimer(sLabel); + if (!pTimer) + return false; + return RemTimer(pTimer); } bool CModule::UnlinkTimer(CTimer* pTimer) {