1
0
mirror of https://github.com/anope/anope.git synced 2026-06-29 20:46:39 +02:00

Start migrating to range-based for loops.

This commit is contained in:
Sadie Powell
2023-10-10 21:14:50 +01:00
parent dc371aad6d
commit a3241065c5
146 changed files with 1157 additions and 1459 deletions
+4 -6
View File
@@ -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;
}