From af9d3617375b3fb013dc6ac49a1926bde4f775e0 Mon Sep 17 00:00:00 2001 From: w00t Date: Wed, 16 Jan 2008 16:19:57 +0000 Subject: Remove an O(log n) in favour of an O(1) operation, and tidy up culllist some more git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8717 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/cull_list.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'src/cull_list.cpp') diff --git a/src/cull_list.cpp b/src/cull_list.cpp index 2b769e893..365cca231 100644 --- a/src/cull_list.cpp +++ b/src/cull_list.cpp @@ -19,16 +19,14 @@ CullList::CullList(InspIRCd* Instance) : ServerInstance(Instance) { list.clear(); - exempt.clear(); } void CullList::AddItem(User* user) { - if (exempt.find(user) == exempt.end()) - { - list.push_back(user); - exempt[user] = user; - } + if (user->quitting) + return; + + list.push_back(user); } void CullList::MakeSilent(User* user) @@ -48,7 +46,6 @@ int CullList::Apply() User *u = (*a); user_hash::iterator iter = ServerInstance->clientlist->find(u->nick); - std::map::iterator exemptiter = exempt.find(u); const char* preset_reason = u->GetOperQuit(); std::string reason = u->operquitmsg; std::string oper_reason = *preset_reason ? preset_reason : u->operquitmsg; @@ -131,7 +128,6 @@ int CullList::Apply() delete u; list.erase(list.begin()); - exempt.erase(exemptiter); } return n; -- cgit v1.2.3