From ef24ec632da12f272eddcf9924eacde9260597a2 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Thu, 1 Apr 2021 18:10:11 +0100 Subject: Constify variables within loops. --- src/configreader.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/configreader.cpp') diff --git a/src/configreader.cpp b/src/configreader.cpp index a40c935cd..dcd5687be 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -74,7 +74,7 @@ static void ReadXLine(ServerConfig* conf, const std::string& tag, const std::str { insp::flat_set configlines; - for (auto& [_, ctag] : conf->ConfTags(tag)) + for (const auto& [_, ctag] : conf->ConfTags(tag)) { const std::string mask = ctag->getString(key); if (mask.empty()) @@ -98,7 +98,7 @@ typedef std::map> LocalIndex; void ServerConfig::CrossCheckOperClassType() { LocalIndex operclass; - for (auto& [_, tag] : ConfTags("class")) + for (const auto& [_, tag] : ConfTags("class")) { std::string name = tag->getString("name"); if (name.empty()) @@ -108,7 +108,7 @@ void ServerConfig::CrossCheckOperClassType() operclass[name] = tag; } - for (auto& [_, tag] : ConfTags("type")) + for (const auto& [_, tag] : ConfTags("type")) { std::string name = tag->getString("name"); if (name.empty()) @@ -131,7 +131,7 @@ void ServerConfig::CrossCheckOperClassType() } } - for (auto& [_, tag] : ConfTags("oper")) + for (const auto& [_, tag] : ConfTags("oper")) { std::string name = tag->getString("name"); if (name.empty()) @@ -158,7 +158,7 @@ void ServerConfig::CrossCheckConnectBlocks(ServerConfig* current) ClassMap oldBlocksByMask; if (current) { - for (auto& c : current->Classes) + for (const auto& c : current->Classes) { switch (c->type) { @@ -192,7 +192,7 @@ void ServerConfig::CrossCheckConnectBlocks(ServerConfig* current) { try_again = false; size_t i = 0; - for (auto& [_, tag] : ConfTags("connect")) + for (const auto& [_, tag] : ConfTags("connect")) { if (Classes[i]) { @@ -441,7 +441,7 @@ void ServerConfig::Apply(ServerConfig* old, const std::string &useruid) if (!dietags.empty()) { errstr << "Your configuration has not been edited correctly!" << std::endl; - for (auto& [_, tag] : dietags) + for (const auto& [_, tag] : dietags) { const std::string reason = tag->getString("reason", "You left a tag in your config", 1); errstr << reason << " (at " << tag->source.str() << ")" << std::endl; @@ -543,7 +543,7 @@ void ServerConfig::ApplyModules(User* user) std::vector added_modules; ModuleManager::ModuleMap removed_modules = ServerInstance->Modules.GetModules(); - for (auto& [_, tag] : ConfTags("module")) + for (const auto& [_, tag] : ConfTags("module")) { std::string name; if (tag->readString("name", name)) -- cgit v1.3.1-10-gc9f91