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 /src/protocol.cpp | |
parent | dc371aad6d059dbf7f30f6878c680532bedd4146 (diff) |
Start migrating to range-based for loops.
Diffstat (limited to 'src/protocol.cpp')
-rw-r--r-- | src/protocol.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/protocol.cpp b/src/protocol.cpp index 6cba86a9b..090187819 100644 --- a/src/protocol.cpp +++ b/src/protocol.cpp @@ -389,10 +389,8 @@ bool IRCDProto::IsIdentValid(const Anope::string &ident) if (ident.empty() || ident.length() > Config->GetBlock("networkinfo")->Get<unsigned>("userlen")) return false; - for (unsigned i = 0; i < ident.length(); ++i) + for (auto c : ident) { - const char &c = ident[i]; - if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') || c == '.' || c == '-') continue; @@ -416,11 +414,11 @@ bool IRCDProto::IsHostValid(const Anope::string &host) return false; int dots = 0; - for (unsigned i = 0; i < host.length(); ++i) + for (auto chr : host) { - if (host[i] == '.') + if (chr == '.') ++dots; - if (vhostchars.find_first_of(host[i]) == Anope::string::npos) + if (vhostchars.find_first_of(chr) == Anope::string::npos) return false; } |