From 4d7c590bb6a937c4c412241ae67b9fc74083b365 Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Sat, 7 Jun 2014 13:07:32 +0200 Subject: m_channames Remove temporary vector from ValidateChans() --- src/modules/m_channames.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/modules/m_channames.cpp b/src/modules/m_channames.cpp index be9eda2b9..5a38fbbc2 100644 --- a/src/modules/m_channames.cpp +++ b/src/modules/m_channames.cpp @@ -65,17 +65,15 @@ class ModuleChannelNames : public Module void ValidateChans() { badchan = true; - std::vector chanvec; const chan_hash& chans = ServerInstance->GetChans(); - for (chan_hash::const_iterator i = chans.begin(); i != chans.end(); ++i) + for (chan_hash::const_iterator i = chans.begin(); i != chans.end(); ) { - if (!ServerInstance->IsChannel(i->second->name)) - chanvec.push_back(i->second); - } - std::vector::reverse_iterator c2 = chanvec.rbegin(); - while (c2 != chanvec.rend()) - { - Channel* c = *c2++; + Channel* c = i->second; + // Move iterator before we begin kicking + ++i; + if (ServerInstance->IsChannel(c->name)) + continue; // The name of this channel is still valid + if (c->IsModeSet(permchannelmode) && c->GetUserCounter()) { std::vector modes; -- cgit v1.2.3