From 57f498f8045c9ca010b09b860fe7c5a9ef9cf8c4 Mon Sep 17 00:00:00 2001 From: brain Date: Fri, 10 Mar 2006 12:13:19 +0000 Subject: Faster CullItem/CullList using strdup rather than copying a std::string git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3626 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/cull_list.cpp | 13 +++++++++---- src/svn-rev.sh | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/cull_list.cpp b/src/cull_list.cpp index b7254fd0b..0951a3224 100644 --- a/src/cull_list.cpp +++ b/src/cull_list.cpp @@ -84,13 +84,18 @@ bool CullList::IsValid(userrec* user) CullItem::CullItem(userrec* u, std::string &r) { this->user = u; - this->reason = r; + this->reason = strdup(r.c_str()); } CullItem::CullItem(userrec* u, const char* r) { this->user = u; - this->reason = r; + this->reason = strdup(r); +} + +CullItem::~CullItem() +{ + free(reason); } userrec* CullItem::GetUser() @@ -98,7 +103,7 @@ userrec* CullItem::GetUser() return this->user; } -std::string CullItem::GetReason() +const char* CullItem::GetReason() { return this->reason; } @@ -145,7 +150,7 @@ int CullList::Apply() */ if (IsValid(u)) { - kill_link(u,a->GetReason().c_str()); + kill_link(u,a->GetReason()); list.erase(list.begin()); /* So that huge numbers of quits dont block, * we yield back to our mainloop every 15 diff --git a/src/svn-rev.sh b/src/svn-rev.sh index c9ebce74d..8b1f627c1 100755 --- a/src/svn-rev.sh +++ b/src/svn-rev.sh @@ -1 +1 @@ -echo 3623 +echo 3625 -- cgit v1.2.3