diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-03-09 20:11:07 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-03-09 20:11:07 +0000 |
commit | 7a3d08f06cc22688a70c5274fe0dd489f93e9794 (patch) | |
tree | 3c566a885b1c871e0f723c6cec92a07a22939118 | |
parent | 9fd6aff54fa4b554a45841e2f13b401cb34466ab (diff) |
Tidyup to pass some stuff by reference (much faster, no copy involved)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3601 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r-- | include/cull_list.h | 4 | ||||
-rw-r--r-- | src/cull_list.cpp | 4 | ||||
-rwxr-xr-x | src/svn-rev.sh | 2 | ||||
-rw-r--r-- | src/userprocess.cpp | 16 |
4 files changed, 12 insertions, 14 deletions
diff --git a/include/cull_list.h b/include/cull_list.h index cc0f01c06..e20eb1dd0 100644 --- a/include/cull_list.h +++ b/include/cull_list.h @@ -50,7 +50,7 @@ class CullItem * @param u The user to add * @param r The quit reason of the added user */ - CullItem(userrec* u, std::string r); + CullItem(userrec* u, std::string &r); /** Returns a pointer to the user */ userrec* GetUser(); @@ -104,7 +104,7 @@ class CullList * @param user The user to add * @param reason The quit reason of the user being added */ - void AddItem(userrec* user, std::string reason); + void AddItem(userrec* user, std::string &reason); /** Applies the cull list, quitting all the users * on the list with their quit reasons all at once. * This is a very fast operation compared to diff --git a/src/cull_list.cpp b/src/cull_list.cpp index 224a9e3da..a8188701a 100644 --- a/src/cull_list.cpp +++ b/src/cull_list.cpp @@ -81,7 +81,7 @@ bool CullList::IsValid(userrec* user) return false; } -CullItem::CullItem(userrec* u, std::string r) +CullItem::CullItem(userrec* u, std::string &r) { this->user = u; this->reason = r; @@ -103,7 +103,7 @@ CullList::CullList() exempt.clear(); } -void CullList::AddItem(userrec* user, std::string reason) +void CullList::AddItem(userrec* user, std::string &reason) { if (exempt.find(user) == exempt.end()) { diff --git a/src/svn-rev.sh b/src/svn-rev.sh index 8a5cd0790..49b2aecc7 100755 --- a/src/svn-rev.sh +++ b/src/svn-rev.sh @@ -1 +1 @@ -echo 3597 +echo 3600 diff --git a/src/userprocess.cpp b/src/userprocess.cpp index 846dcaeee..30f7d49f8 100644 --- a/src/userprocess.cpp +++ b/src/userprocess.cpp @@ -339,7 +339,7 @@ void DoSocketTimeouts(time_t TIME) */ void DoBackgroundUserStuff(time_t TIME) { - CullList* GlobalGoners = new CullList(); + CullList GlobalGoners; for (std::vector<userrec*>::iterator count2 = local_users.begin(); count2 != local_users.end(); count2++) { @@ -360,7 +360,7 @@ void DoBackgroundUserStuff(time_t TIME) if (((unsigned)TIME > (unsigned)curr->timeout) && (curr->registered != 7)) { log(DEBUG,"InspIRCd: registration timeout: %s",curr->nick); - GlobalGoners->AddItem(curr,"Registration timeout"); + GlobalGoners.AddItem(curr,"Registration timeout"); continue; } @@ -372,14 +372,14 @@ void DoBackgroundUserStuff(time_t TIME) { curr->dns_done = true; ServerInstance->stats->statsDnsBad++; - FullConnectUser(curr,GlobalGoners); + FullConnectUser(curr,&GlobalGoners); continue; } if ((curr->dns_done) && (curr->registered == 3) && (AllModulesReportReady(curr))) { log(DEBUG,"dns done, registered=3, and modules ready, OK"); - FullConnectUser(curr,GlobalGoners); + FullConnectUser(curr,&GlobalGoners); continue; } @@ -389,7 +389,7 @@ void DoBackgroundUserStuff(time_t TIME) // This user didn't answer the last ping, remove them if (!curr->lastping) { - GlobalGoners->AddItem(curr,"Ping timeout"); + GlobalGoners.AddItem(curr,"Ping timeout"); continue; } @@ -406,16 +406,14 @@ void DoBackgroundUserStuff(time_t TIME) if (curr->GetWriteError() != "") { - GlobalGoners->AddItem(curr,curr->GetWriteError()); + GlobalGoners.AddItem(curr,curr->GetWriteError()); continue; } } } /* Remove all the queued users who are due to be quit, free memory used. */ - GlobalGoners->Apply(); - delete GlobalGoners; - return; + GlobalGoners.Apply(); } void OpenLog(char** argv, int argc) |