From 7f255c9e6fa3dfc9f710a9b0725608f920b54b90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sun, 23 Sep 2018 17:02:54 +0200 Subject: [PATCH] Refactoring: Use range for loop --- lib/errorlogger.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/errorlogger.cpp b/lib/errorlogger.cpp index f57caa20e..dee90d829 100644 --- a/lib/errorlogger.cpp +++ b/lib/errorlogger.cpp @@ -546,17 +546,17 @@ std::string ErrorLogger::ErrorMessage::toString(bool verbose, const std::string void ErrorLogger::reportUnmatchedSuppressions(const std::list &unmatched) { // Report unmatched suppressions - for (std::list::const_iterator i = unmatched.begin(); i != unmatched.end(); ++i) { + for (const Suppressions::Suppression &s : unmatched) { // don't report "unmatchedSuppression" as unmatched - if (i->errorId == "unmatchedSuppression") + if (s.errorId == "unmatchedSuppression") continue; // check if this unmatched suppression is suppressed bool suppressed = false; - for (std::list::const_iterator i2 = unmatched.begin(); i2 != unmatched.end(); ++i2) { - if (i2->errorId == "unmatchedSuppression") { - if ((i2->fileName == "*" || i2->fileName == i->fileName) && - (i2->lineNumber == Suppressions::Suppression::NO_LINE || i2->lineNumber == i->lineNumber)) { + for (const Suppressions::Suppression &s2 : unmatched) { + if (s2.errorId == "unmatchedSuppression") { + if ((s2.fileName == "*" || s2.fileName == s.fileName) && + (s2.lineNumber == Suppressions::Suppression::NO_LINE || s2.lineNumber == s.lineNumber)) { suppressed = true; break; } @@ -567,9 +567,9 @@ void ErrorLogger::reportUnmatchedSuppressions(const std::list callStack; - if (!i->fileName.empty()) - callStack.emplace_back(i->fileName, i->lineNumber); - reportErr(ErrorLogger::ErrorMessage(callStack, emptyString, Severity::information, "Unmatched suppression: " + i->errorId, "unmatchedSuppression", false)); + if (!s.fileName.empty()) + callStack.emplace_back(s.fileName, s.lineNumber); + reportErr(ErrorLogger::ErrorMessage(callStack, emptyString, Severity::information, "Unmatched suppression: " + s.errorId, "unmatchedSuppression", false)); } }