diff options
author | Attila Molnar <attilamolnar@hush.com> | 2014-09-27 18:30:01 +0200 |
---|---|---|
committer | Attila Molnar <attilamolnar@hush.com> | 2014-09-27 18:30:01 +0200 |
commit | 8c2cdeaf33bf6fa2d51df0e6e2c0cbdfc3e1230b (patch) | |
tree | 6fc17fc57340f710138b7818dd908d5078e7c3c4 /src | |
parent | 8baacd6ef4ec866c96f40c47f30342b09ebe3a74 (diff) |
Store Membership objects physically in the nodes of Channel::MemberMap
Diffstat (limited to 'src')
-rw-r--r-- | src/channels.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/channels.cpp b/src/channels.cpp index 13595c4c3..2ea8688cf 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -61,11 +61,11 @@ void Channel::SetTopic(User* u, const std::string& ntopic) Membership* Channel::AddUser(User* user) { - Membership*& memb = userlist[user]; - if (memb) + std::pair<MemberMap::iterator, bool> ret = userlist.insert(std::make_pair(user, insp::aligned_storage<Membership>())); + if (!ret.second) return NULL; - memb = new Membership(user, this); + Membership* memb = new(ret.first->second) Membership(user, this); return memb; } @@ -102,7 +102,7 @@ void Channel::DelUser(const MemberMap::iterator& membiter) { Membership* memb = membiter->second; memb->cull(); - delete memb; + memb->~Membership(); userlist.erase(membiter); // If this channel became empty then it should be removed |