From 942fd2bcfd384a12c900999fe663202c87319a68 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Tue, 6 Apr 2021 20:06:18 +0100 Subject: Switch simple iterator loops to use range-based for loops. --- src/configparser.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/configparser.cpp') diff --git a/src/configparser.cpp b/src/configparser.cpp index 2622b7016..e6b312473 100644 --- a/src/configparser.cpp +++ b/src/configparser.cpp @@ -495,9 +495,12 @@ bool ConfigTag::readString(const std::string& key, std::string& value, bool allo { ServerInstance->Logs.Log("CONFIG", LOG_DEFAULT, "Value of <" + name + ":" + key + "> at " + source.str() + " contains a linefeed, and linefeeds in this value are not permitted -- stripped to spaces."); - for (std::string::iterator n = value.begin(); n != value.end(); n++) - if (*n == '\n') - *n = ' '; + + for (auto& chr : value) + { + if (chr == '\n') + chr = ' '; + } } return true; } -- cgit v1.3.1-10-gc9f91