diff options
author | Sadie Powell <sadie@witchery.services> | 2023-10-10 21:14:50 +0100 |
---|---|---|
committer | Sadie Powell <sadie@witchery.services> | 2023-10-11 15:51:52 +0100 |
commit | a3241065c55fd2a69e8793b89a5d0b1a957b3fd0 (patch) | |
tree | 82f80ce2f3bbbdc1c1ef05fe611093cf0b34eab6 /modules/commands/os_session.cpp | |
parent | dc371aad6d059dbf7f30f6878c680532bedd4146 (diff) |
Start migrating to range-based for loops.
Diffstat (limited to 'modules/commands/os_session.cpp')
-rw-r--r-- | modules/commands/os_session.cpp | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/modules/commands/os_session.cpp b/modules/commands/os_session.cpp index 517b22279..07e1e551f 100644 --- a/modules/commands/os_session.cpp +++ b/modules/commands/os_session.cpp @@ -61,9 +61,8 @@ class MySessionService : public SessionService Exception *FindException(User *u) override { - for (std::vector<Exception *>::const_iterator it = this->Exceptions->begin(), it_end = this->Exceptions->end(); it != it_end; ++it) + for (auto *e : *this->Exceptions) { - Exception *e = *it; if (Anope::Match(u->host, e->mask) || Anope::Match(u->ip.addr(), e->mask)) return e; @@ -75,9 +74,8 @@ class MySessionService : public SessionService Exception *FindException(const Anope::string &host) override { - for (std::vector<Exception *>::const_iterator it = this->Exceptions->begin(), it_end = this->Exceptions->end(); it != it_end; ++it) + for (auto *e : *this->Exceptions) { - Exception *e = *it; if (Anope::Match(host, e->mask)) return e; @@ -191,10 +189,8 @@ class CommandOSSession : public Command ListFormatter list(source.GetAccount()); list.AddColumn(_("Session")).AddColumn(_("Host")); - for (SessionService::SessionMap::iterator it = session_service->GetSessions().begin(), it_end = session_service->GetSessions().end(); it != it_end; ++it) + for (const auto &[_, session] : session_service->GetSessions()) { - Session *session = it->second; - if (session->count >= mincount) { ListFormatter::ListEntry entry; @@ -210,8 +206,8 @@ class CommandOSSession : public Command list.Process(replies); - for (unsigned i = 0; i < replies.size(); ++i) - source.Reply(replies[i]); + for (const auto &reply : replies) + source.Reply(reply); } return; @@ -347,9 +343,8 @@ class CommandOSException : public Command return; } - for (std::vector<Exception *>::iterator it = session_service->GetExceptions().begin(), it_end = session_service->GetExceptions().end(); it != it_end; ++it) + for (auto *e : session_service->GetExceptions()) { - Exception *e = *it; if (e->mask.equals_ci(mask)) { if (e->limit != limit) @@ -495,8 +490,8 @@ class CommandOSException : public Command std::vector<Anope::string> replies; list.Process(replies); - for (unsigned i = 0; i < replies.size(); ++i) - source.Reply(replies[i]); + for (const auto &reply : replies) + source.Reply(reply); } } |