Refactoring

This commit is contained in:
jrp2014 2018-04-04 21:11:23 +02:00 committed by Daniel Marjamäki
parent 07b5afcdc6
commit b813a6d407
2 changed files with 5 additions and 9 deletions

View File

@ -261,11 +261,10 @@ bool CmdLineParser::ParseFromArgs(int argc, const char* const argv[])
if (pos == std::string::npos) { if (pos == std::string::npos) {
_settings->basePaths.push_back(Path::fromNativeSeparators(paths)); _settings->basePaths.push_back(Path::fromNativeSeparators(paths));
break; break;
} else { }
_settings->basePaths.push_back(Path::fromNativeSeparators(paths.substr(0, pos))); _settings->basePaths.push_back(Path::fromNativeSeparators(paths.substr(0, pos)));
paths.erase(0, pos + 1); paths.erase(0, pos + 1);
} }
}
} else { } else {
PrintMessage("cppcheck: No paths specified for the '" + std::string(argv[i]) + "' option."); PrintMessage("cppcheck: No paths specified for the '" + std::string(argv[i]) + "' option.");
return false; return false;

View File

@ -121,8 +121,7 @@ bool CppCheckExecutor::parseFromArgs(CppCheck *cppcheck, int argc, const char* c
// Check that all include paths exist // Check that all include paths exist
{ {
std::list<std::string>::iterator iter; for (std::list<std::string>::iterator iter = settings.includePaths.begin();
for (iter = settings.includePaths.begin();
iter != settings.includePaths.end(); iter != settings.includePaths.end();
) { ) {
const std::string path(Path::toNativeSeparators(*iter)); const std::string path(Path::toNativeSeparators(*iter));
@ -195,9 +194,8 @@ int CppCheckExecutor::check(int argc, const char* const argv[])
} }
if (cppCheck.settings().exceptionHandling) { if (cppCheck.settings().exceptionHandling) {
return check_wrapper(cppCheck, argc, argv); return check_wrapper(cppCheck, argc, argv);
} else {
return check_internal(cppCheck, argc, argv);
} }
return check_internal(cppCheck, argc, argv);
} }
void CppCheckExecutor::setSettings(const Settings &settings) void CppCheckExecutor::setSettings(const Settings &settings)
@ -949,7 +947,6 @@ int CppCheckExecutor::check_internal(CppCheck& cppcheck, int /*argc*/, const cha
_settings = nullptr; _settings = nullptr;
if (returnValue) if (returnValue)
return settings.exitCode; return settings.exitCode;
else
return 0; return 0;
} }