summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-03-10 12:26:14 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-03-10 12:26:14 +0000
commitb041a609e4b3f09205c7390fe661970629128468 (patch)
treebb460a4ed109cdf4e606eda42921af00735a3a42
parent02497f5a89123c679260be44f4d2068b0a7f34e4 (diff)
Revert to string but return a reference, should be about the same speed
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3628 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--include/cull_list.h2
-rw-r--r--src/cull_list.cpp11
2 files changed, 5 insertions, 8 deletions
diff --git a/include/cull_list.h b/include/cull_list.h
index df91e2eca..683e4493b 100644
--- a/include/cull_list.h
+++ b/include/cull_list.h
@@ -60,7 +60,7 @@ class CullItem
userrec* GetUser();
/** Returns the user's quit reason
*/
- const char* GetReason();
+ std::string& GetReason();
};
/** The CullList class can be used by modules, and is used
diff --git a/src/cull_list.cpp b/src/cull_list.cpp
index a911cbc78..74400ef1b 100644
--- a/src/cull_list.cpp
+++ b/src/cull_list.cpp
@@ -84,20 +84,17 @@ bool CullList::IsValid(userrec* user)
CullItem::CullItem(userrec* u, std::string &r)
{
this->user = u;
- this->reason = strdup(r.c_str());
+ this->reason = r;
}
CullItem::CullItem(userrec* u, const char* r)
{
this->user = u;
- this->reason = strdup(r);
+ this->reason = r;
}
CullItem::~CullItem()
{
- if (reason)
- free(reason);
- reason = NULL;
}
userrec* CullItem::GetUser()
@@ -105,7 +102,7 @@ userrec* CullItem::GetUser()
return this->user;
}
-const char* CullItem::GetReason()
+std::string& CullItem::GetReason()
{
return this->reason;
}
@@ -152,7 +149,7 @@ int CullList::Apply()
*/
if (IsValid(u))
{
- kill_link(u,a->GetReason());
+ kill_link(u,a->GetReason().c_str());
list.erase(list.begin());
/* So that huge numbers of quits dont block,
* we yield back to our mainloop every 15