Refactoring, use range for loop

This commit is contained in:
Daniel Marjamäki 2018-06-17 08:40:25 +02:00
parent 87b21f3e57
commit f8e96307f7
1 changed files with 3 additions and 4 deletions

View File

@ -785,13 +785,12 @@ bool Preprocessor::validateCfg(const std::string &cfg, const std::list<simplecpp
if (defineIt->find('=') != std::string::npos) if (defineIt->find('=') != std::string::npos)
continue; continue;
const std::string macroName(defineIt->substr(0, defineIt->find('('))); const std::string macroName(defineIt->substr(0, defineIt->find('(')));
for (std::list<simplecpp::MacroUsage>::const_iterator usageIt = macroUsageList.begin(); usageIt != macroUsageList.end(); ++usageIt) { for (const simplecpp::MacroUsage &mu : macroUsageList) {
const simplecpp::MacroUsage &mu = *usageIt;
if (mu.macroName != macroName) if (mu.macroName != macroName)
continue; continue;
bool directiveLocation = false; bool directiveLocation = false;
for (std::list<Directive>::const_iterator dirIt = directives.begin(); dirIt != directives.end(); ++dirIt) { for (const Directive &dir : directives) {
if (mu.useLocation.file() == dirIt->file && mu.useLocation.line == dirIt->linenr) { if (mu.useLocation.file() == dir.file && mu.useLocation.line == dir.linenr) {
directiveLocation = true; directiveLocation = true;
break; break;
} }