From: Attila Molnar Date: Sat, 7 Jun 2014 11:07:32 +0000 (+0200) Subject: m_channames Remove temporary vector from ValidateChans() X-Git-Url: https://git.netwichtig.de/gitweb/?a=commitdiff_plain;ds=inline;h=4d7c590bb6a937c4c412241ae67b9fc74083b365;p=user%2Fhenk%2Fcode%2Finspircd.git m_channames Remove temporary vector from ValidateChans() --- 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;