1
0
mirror of https://github.com/anope/anope.git synced 2026-06-29 14:56:37 +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
+11 -15
View File
@@ -71,11 +71,11 @@ static bool GetCommandLineArgument(const Anope::string &name, char shortname, An
{
param.clear();
for (std::vector<std::pair<Anope::string, Anope::string> >::iterator it = CommandLineArguments.begin(), it_end = CommandLineArguments.end(); it != it_end; ++it)
for (const auto &[argument, value] : CommandLineArguments)
{
if (it->first.equals_ci(name) || (it->first.length() == 1 && it->first[0] == shortname))
if (argument.equals_ci(name) || (argument.length() == 1 && argument[0] == shortname))
{
param = it->second;
param = argument;
return true;
}
}
@@ -258,14 +258,10 @@ static void setuidgid()
gid = g->gr_gid;
}
for (unsigned i = 0; i < Config->LogInfos.size(); ++i)
for (const auto &li : Config->LogInfos)
{
LogInfo& li = Config->LogInfos[i];
for (unsigned j = 0; j < li.logfiles.size(); ++j)
for (const auto *lf : li.logfiles)
{
LogFile* lf = li.logfiles[j];
errno = 0;
if (chown(lf->filename.c_str(), uid, gid) != 0)
Log() << "Unable to change the ownership of " << lf->filename << " to " << uid << "/" << gid << ": " << Anope::LastError();
@@ -489,9 +485,9 @@ void Anope::Init(int ac, char **av)
/* Create me */
Configuration::Block *block = Config->GetBlock("serverinfo");
Me = new Server(NULL, block->Get<const Anope::string>("name"), 0, block->Get<const Anope::string>("description"), block->Get<const Anope::string>("id"));
for (botinfo_map::const_iterator it = BotListByNick->begin(), it_end = BotListByNick->end(); it != it_end; ++it)
for (const auto &[_, bi] : *BotListByNick)
{
it->second->server = Me;
bi->server = Me;
++Me->users;
}
@@ -547,8 +543,8 @@ void Anope::Init(int ac, char **av)
Anope::string sid = IRCD->SID_Retrieve();
if (Me->GetSID() == Me->GetName())
Me->SetSID(sid);
for (botinfo_map::iterator it = BotListByNick->begin(), it_end = BotListByNick->end(); it != it_end; ++it)
it->second->GenerateUID();
for (const auto &[_, bi] : *BotListByNick)
bi->GenerateUID();
}
/* Load up databases */
@@ -560,8 +556,8 @@ void Anope::Init(int ac, char **av)
FOREACH_MOD(OnPostInit, ());
for (channel_map::const_iterator it = ChannelList.begin(), it_end = ChannelList.end(); it != it_end; ++it)
it->second->Sync();
for (const auto &[_, ci] : ChannelList)
ci->Sync();
Serialize::CheckTypes();
}