]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Tidyup to pass some stuff by reference (much faster, no copy involved)
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Thu, 9 Mar 2006 20:11:07 +0000 (20:11 +0000)
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Thu, 9 Mar 2006 20:11:07 +0000 (20:11 +0000)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3601 e03df62e-2008-0410-955e-edbf42e46eb7

include/cull_list.h
src/cull_list.cpp
src/svn-rev.sh
src/userprocess.cpp

index cc0f01c06641589d4a99e2ad413222cd0ff3943b..e20eb1dd07b46f86bc54402db687ab07440ed52a 100644 (file)
@@ -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
index 224a9e3da0b55fc9792aec1f314f54a570bcbc82..a8188701a0114ebf11c7602d0dee8fb9df7fcb24 100644 (file)
@@ -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())
        {
index 8a5cd0790b7a918cfb95bc7dad92940c490d29a2..49b2aecc72f04a004844fef35a9ecd50bae2a7b3 100755 (executable)
@@ -1 +1 @@
-echo 3597
+echo 3600
index 846dcaeee52c6315e9baf53050623a2cd047b4f1..30f7d49f8f98a31d89a75bb26b644cc448cc0223 100644 (file)
@@ -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)