From b813a6d407055ed3a337816abb648a3875dc7634 Mon Sep 17 00:00:00 2001 From: jrp2014 Date: Wed, 4 Apr 2018 21:11:23 +0200 Subject: [PATCH] Refactoring --- cli/cmdlineparser.cpp | 5 ++--- cli/cppcheckexecutor.cpp | 9 +++------ 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/cli/cmdlineparser.cpp b/cli/cmdlineparser.cpp index 3cbd6cffb..64ad809e8 100644 --- a/cli/cmdlineparser.cpp +++ b/cli/cmdlineparser.cpp @@ -261,10 +261,9 @@ bool CmdLineParser::ParseFromArgs(int argc, const char* const argv[]) if (pos == std::string::npos) { _settings->basePaths.push_back(Path::fromNativeSeparators(paths)); break; - } else { - _settings->basePaths.push_back(Path::fromNativeSeparators(paths.substr(0, pos))); - paths.erase(0, pos + 1); } + _settings->basePaths.push_back(Path::fromNativeSeparators(paths.substr(0, pos))); + paths.erase(0, pos + 1); } } else { PrintMessage("cppcheck: No paths specified for the '" + std::string(argv[i]) + "' option."); diff --git a/cli/cppcheckexecutor.cpp b/cli/cppcheckexecutor.cpp index 949ed8cea..2b0a2ba7f 100644 --- a/cli/cppcheckexecutor.cpp +++ b/cli/cppcheckexecutor.cpp @@ -121,8 +121,7 @@ bool CppCheckExecutor::parseFromArgs(CppCheck *cppcheck, int argc, const char* c // Check that all include paths exist { - std::list::iterator iter; - for (iter = settings.includePaths.begin(); + for (std::list::iterator iter = settings.includePaths.begin(); iter != settings.includePaths.end(); ) { const std::string path(Path::toNativeSeparators(*iter)); @@ -195,9 +194,8 @@ int CppCheckExecutor::check(int argc, const char* const argv[]) } if (cppCheck.settings().exceptionHandling) { 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) @@ -949,8 +947,7 @@ int CppCheckExecutor::check_internal(CppCheck& cppcheck, int /*argc*/, const cha _settings = nullptr; if (returnValue) return settings.exitCode; - else - return 0; + return 0; } #ifdef _WIN32