summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-03-10 12:13:19 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-03-10 12:13:19 +0000
commit57f498f8045c9ca010b09b860fe7c5a9ef9cf8c4 (patch)
treee7965fb7d5abf4794e0bbd4d37e73ea3572bcf38
parent1acda32c6a39372b72c18b04d976eb07f4bee676 (diff)
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
-rw-r--r--include/cull_list.h7
-rw-r--r--src/cull_list.cpp13
-rwxr-xr-xsrc/svn-rev.sh2
3 files changed, 15 insertions, 7 deletions
diff --git a/include/cull_list.h b/include/cull_list.h
index ca7189f4c..df91e2eca 100644
--- a/include/cull_list.h
+++ b/include/cull_list.h
@@ -42,7 +42,7 @@ class CullItem
userrec* user;
/** Holds the quit reason to use for this user.
*/
- std::string reason;
+ char* reason;
public:
/** Constrcutor.
* Initializes the CullItem with a user pointer
@@ -52,12 +52,15 @@ class CullItem
*/
CullItem(userrec* u, std::string &r);
CullItem(userrec* u, const char* r);
+
+ ~CullItem();
+
/** Returns a pointer to the user
*/
userrec* GetUser();
/** Returns the user's quit reason
*/
- std::string GetReason();
+ const char* 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 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