diff options
| author | 2021-04-06 20:06:18 +0100 | |
|---|---|---|
| committer | 2021-04-07 10:36:11 +0100 | |
| commit | 942fd2bcfd384a12c900999fe663202c87319a68 (patch) | |
| tree | c2bad1906af27afbc3c7d96c3e5ca3c27c83f090 /src/modules/m_permchannels.cpp | |
| parent | Merge branch 'insp3' into master. (diff) | |
| download | inspircd++-942fd2bcfd384a12c900999fe663202c87319a68.tar.gz inspircd++-942fd2bcfd384a12c900999fe663202c87319a68.tar.bz2 inspircd++-942fd2bcfd384a12c900999fe663202c87319a68.zip | |
Switch simple iterator loops to use range-based for loops.
Diffstat (limited to 'src/modules/m_permchannels.cpp')
| -rw-r--r-- | src/modules/m_permchannels.cpp | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/src/modules/m_permchannels.cpp b/src/modules/m_permchannels.cpp index c87b41244..cbafba911 100644 --- a/src/modules/m_permchannels.cpp +++ b/src/modules/m_permchannels.cpp @@ -82,10 +82,8 @@ static bool WriteDatabase(PermChannel& permchanmode, Module* mod, bool save_list << "# Any changes to this file will be automatically overwritten." << std::endl << std::endl; - const chan_hash& chans = ServerInstance->GetChans(); - for (chan_hash::const_iterator i = chans.begin(); i != chans.end(); ++i) + for (const auto& [_, chan] : ServerInstance->GetChans()) { - Channel* chan = i->second; if (!chan->IsModeSet(permchanmode)) continue; @@ -95,24 +93,21 @@ static bool WriteDatabase(PermChannel& permchanmode, Module* mod, bool save_list std::string modes; std::string params; - const ModeParser::ListModeList& listmodes = ServerInstance->Modes.GetListModes(); - for (ModeParser::ListModeList::const_iterator j = listmodes.begin(); j != listmodes.end(); ++j) + for (const auto& lm : ServerInstance->Modes.GetListModes()) { - ListModeBase* lm = *j; ListModeBase::ModeList* list = lm->GetList(chan); if (!list || list->empty()) continue; - size_t n = 0; // Append the parameters - for (ListModeBase::ModeList::const_iterator k = list->begin(); k != list->end(); ++k, n++) + for (const auto& entry : *list) { - params += k->mask; + params += entry.mask; params += ' '; } // Append the mode letters (for example "IIII", "gg") - modes.append(n, lm->GetModeChar()); + modes.append(list->size(), lm->GetModeChar()); } if (!params.empty()) @@ -243,9 +238,9 @@ public: list.GetToken(modeseq); // XXX bleh, should we pass this to the mode parser instead? ugly. --w00t - for (std::string::iterator n = modeseq.begin(); n != modeseq.end(); ++n) + for (const auto& modechr : modeseq) { - ModeHandler* mode = ServerInstance->Modes.FindMode(*n, MODETYPE_CHANNEL); + ModeHandler* mode = ServerInstance->Modes.FindMode(modechr, MODETYPE_CHANNEL); if (mode) { if (mode->NeedsParam(true)) |
