From 942fd2bcfd384a12c900999fe663202c87319a68 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Tue, 6 Apr 2021 20:06:18 +0100 Subject: Switch simple iterator loops to use range-based for loops. --- src/modules/m_dccallow.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/modules/m_dccallow.cpp') diff --git a/src/modules/m_dccallow.cpp b/src/modules/m_dccallow.cpp index 20e15bd71..14032a9a9 100644 --- a/src/modules/m_dccallow.cpp +++ b/src/modules/m_dccallow.cpp @@ -274,9 +274,9 @@ class CommandDccallow : public Command return CmdResult::FAILURE; } - for (dccallowlist::const_iterator k = dl->begin(); k != dl->end(); ++k) + for (const auto& dccallow : *dl) { - if (k->nickname == target->nick) + if (dccallow.nickname == target->nick) { user->WriteNumeric(ERR_DCCALLOWINVALID, user->nick, InspIRCd::Format("%s is already on your DCCALLOW list", target->nick.c_str())); return CmdResult::FAILURE; @@ -358,9 +358,10 @@ class CommandDccallow : public Command dl = ext.Get(user); if (dl) { - for (dccallowlist::const_iterator c = dl->begin(); c != dl->end(); ++c) + for (const auto& dccallow : *dl) { - user->WriteNumeric(RPL_DCCALLOWLIST, user->nick, InspIRCd::Format("%s (%s)", c->nickname.c_str(), c->hostmask.c_str())); + user->WriteNumeric(RPL_DCCALLOWLIST, user->nick, InspIRCd::Format("%s (%s)", + dccallow.nickname.c_str(), dccallow.hostmask.c_str())); } } @@ -430,9 +431,11 @@ class ModuleDCCAllow : public Module dl = ext.Get(u); if (dl && dl->size()) { - for (dccallowlist::const_iterator iter = dl->begin(); iter != dl->end(); ++iter) - if (InspIRCd::Match(user->GetFullHost(), iter->hostmask)) + for (const auto& dccallow : *dl) + { + if (InspIRCd::Match(user->GetFullHost(), dccallow.hostmask)) return MOD_RES_PASSTHRU; + } } size_t s = ctcpbody.find(' '); -- cgit v1.3.1-10-gc9f91