]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Change allocation of UserManager::uuidlist to be physically part of the object contai...
authorAttila Molnar <attilamolnar@hush.com>
Fri, 14 Mar 2014 12:04:10 +0000 (13:04 +0100)
committerAttila Molnar <attilamolnar@hush.com>
Fri, 14 Mar 2014 12:04:10 +0000 (13:04 +0100)
include/usermanager.h
src/helperfuncs.cpp
src/usermanager.cpp
src/users.cpp

index e287d74d0be434f3799969292dac53612751a5a2..b1c3520e9551db9cfcb7f6b9c9d58206bf41e740 100644 (file)
@@ -48,7 +48,7 @@ class CoreExport UserManager
        /** Client list stored by UUID. Contains all clients, and is updated
         * automatically by the constructor and destructor of User.
         */
-       user_hash* uuidlist;
+       user_hash uuidlist;
 
        /** Local client list, a list containing only local clients
         */
index 850eaf4c0ddc81ca4ca9780d2234d7d07fa8a16e..567806efcef407ded6176ab17e3514aac5ec8af7 100644 (file)
@@ -59,9 +59,9 @@ User* InspIRCd::FindNickOnly(const std::string &nick)
 
 User *InspIRCd::FindUUID(const std::string &uid)
 {
-       user_hash::iterator finduuid = this->Users->uuidlist->find(uid);
+       user_hash::iterator finduuid = this->Users->uuidlist.find(uid);
 
-       if (finduuid == this->Users->uuidlist->end())
+       if (finduuid == this->Users->uuidlist.end())
                return NULL;
 
        return finduuid->second;
index 12db0dde2fb406d0fa0a43efc86db79594372eb0..2a9f02cfdbe5893f350180011978e6dd9efbba91 100644 (file)
@@ -27,7 +27,6 @@
 
 UserManager::UserManager()
        : clientlist(new user_hash)
-       , uuidlist(new user_hash)
        , unregistered_count(0)
 {
 }
@@ -40,7 +39,6 @@ UserManager::~UserManager()
        }
 
        delete clientlist;
-       delete uuidlist;
 }
 
 /* add a client connection to the sockets list */
@@ -208,7 +206,7 @@ void UserManager::QuitUser(User* user, const std::string& quitreason, const std:
        else
                ServerInstance->Logs->Log("USERS", LOG_DEFAULT, "ERROR: Nick not found in clientlist, cannot remove: " + user->nick);
 
-       uuidlist->erase(user->uuid);
+       uuidlist.erase(user->uuid);
        user->PurgeEmptyChannels();
 }
 
index 1c13ac4efcf3fe7e5dedcb3ba0a882d1bd9dd016..e760a3fbc3284e219964f921239edfeea5392854 100644 (file)
@@ -79,7 +79,7 @@ User::User(const std::string& uid, Server* srv, int type)
 
        ServerInstance->Logs->Log("USERS", LOG_DEBUG, "New UUID for user: %s", uuid.c_str());
 
-       if (!ServerInstance->Users->uuidlist->insert(std::make_pair(uuid, this)).second)
+       if (!ServerInstance->Users->uuidlist.insert(std::make_pair(uuid, this)).second)
                throw CoreException("Duplicate UUID "+std::string(uuid)+" in User constructor");
 }
 
@@ -100,7 +100,7 @@ LocalUser::LocalUser(int myfd, irc::sockets::sockaddrs* client, irc::sockets::so
 
 User::~User()
 {
-       if (ServerInstance->Users->uuidlist->find(uuid) != ServerInstance->Users->uuidlist->end())
+       if (ServerInstance->FindUUID(uuid))
                ServerInstance->Logs->Log("USERS", LOG_DEFAULT, "User destructor for %s called without cull", uuid.c_str());
 }
 
@@ -344,7 +344,7 @@ CullResult FakeUser::cull()
        // Fake users don't quit, they just get culled.
        quitting = true;
        // Fake users are not inserted into UserManager::clientlist, they're only in the uuidlist
-       ServerInstance->Users->uuidlist->erase(uuid);
+       ServerInstance->Users->uuidlist.erase(uuid);
        return User::cull();
 }