diff options
author | attilamolnar <attilamolnar@hush.com> | 2012-06-15 03:26:47 +0200 |
---|---|---|
committer | attilamolnar <attilamolnar@hush.com> | 2012-07-13 17:27:03 +0200 |
commit | 2a5cab9b4471b4536c3576ec20cb2b6d6bc122e3 (patch) | |
tree | b57ea823da8762d378cea52c46ce5ac0fab34617 /src | |
parent | 414e1249e548936b6430c895b75ccbfdf29e00c1 (diff) |
Use less memory when rehashing built-in hashmaps
Diffstat (limited to 'src')
-rw-r--r-- | src/inspircd.cpp | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/src/inspircd.cpp b/src/inspircd.cpp index cf8c22633..aa03d62de 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -195,24 +195,21 @@ void InspIRCd::ResetMaxBans() void InspIRCd::RehashUsersAndChans() { user_hash* old_users = Users->clientlist; - user_hash* old_uuid = Users->uuidlist; - chan_hash* old_chans = chanlist; - - Users->clientlist = new user_hash(); - Users->uuidlist = new user_hash(); - chanlist = new chan_hash(); - + Users->clientlist = new user_hash; for (user_hash::const_iterator n = old_users->begin(); n != old_users->end(); n++) Users->clientlist->insert(*n); + delete old_users; + user_hash* old_uuid = Users->uuidlist; + Users->uuidlist = new user_hash; for (user_hash::const_iterator n = old_uuid->begin(); n != old_uuid->end(); n++) Users->uuidlist->insert(*n); + delete old_uuid; + chan_hash* old_chans = chanlist; + chanlist = new chan_hash; for (chan_hash::const_iterator n = old_chans->begin(); n != old_chans->end(); n++) chanlist->insert(*n); - - delete old_users; - delete old_uuid; delete old_chans; // Reset the already_sent IDs so we don't wrap it around and drop a message |