summaryrefslogtreecommitdiff
path: root/src/cull_list.cpp
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-04-17 21:47:30 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-04-17 21:47:30 +0000
commite988ac11a2fb6f8db35f2e645e519678135c1587 (patch)
tree008546a1d7feb37ca6410e09c6dc39a250e7a899 /src/cull_list.cpp
parent83c2e15a7de4abed1e286d9e0758a9d92ddbb480 (diff)
Fix CullList to not use O(n^2) version of vector clear
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11312 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/cull_list.cpp')
-rw-r--r--src/cull_list.cpp15
1 files changed, 4 insertions, 11 deletions
diff --git a/src/cull_list.cpp b/src/cull_list.cpp
index a1881fe3d..07649ed81 100644
--- a/src/cull_list.cpp
+++ b/src/cull_list.cpp
@@ -18,7 +18,6 @@
CullList::CullList(InspIRCd* Instance) : ServerInstance(Instance)
{
- list.clear();
}
void CullList::AddItem(User* user)
@@ -32,15 +31,11 @@ void CullList::MakeSilent(User* user)
return;
}
-int CullList::Apply()
+void CullList::Apply()
{
- int n = list.size();
-
- while (list.size())
+ for(std::vector<User *>::iterator a = list.begin(); a != list.end(); a++)
{
- std::vector<User *>::iterator a = list.begin();
-
- User *u = (*a);
+ User *u = *a;
// user has been moved onto their UID; that's why this isn't find(u->nick)
user_hash::iterator iter = ServerInstance->Users->clientlist->find(u->uuid);
@@ -113,9 +108,7 @@ int CullList::Apply()
}
delete u;
- list.erase(list.begin());
}
-
- return n;
+ list.clear();
}