]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
m_channames Remove temporary vector from ValidateChans()
authorAttila Molnar <attilamolnar@hush.com>
Sat, 7 Jun 2014 11:07:32 +0000 (13:07 +0200)
committerAttila Molnar <attilamolnar@hush.com>
Sat, 7 Jun 2014 11:07:32 +0000 (13:07 +0200)
src/modules/m_channames.cpp

index be9eda2b9ca5a9cdc053e952d134db020f2f29e2..5a38fbbc2ad22480b43402ede7e8fb4c1fa6e30c 100644 (file)
@@ -65,17 +65,15 @@ class ModuleChannelNames : public Module
        void ValidateChans()
        {
                badchan = true;
-               std::vector<Channel*> 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<Channel*>::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<std::string> modes;