diff options
author | Daniel Pfeifer <daniel@pfeifer-mail.de> | 2016-05-26 21:05:30 (GMT) |
---|---|---|
committer | Daniel Pfeifer <daniel@pfeifer-mail.de> | 2016-06-02 19:35:50 (GMT) |
commit | c6220de27605f33b2793729680c32714cd126690 (patch) | |
tree | edd5725b84c0d2ed910b9ec945d3086f5324f9aa /Source/CTest | |
parent | 9ca8c7a99f193179ebfc893060966c37e3efabca (diff) | |
download | CMake-c6220de27605f33b2793729680c32714cd126690.zip CMake-c6220de27605f33b2793729680c32714cd126690.tar.gz CMake-c6220de27605f33b2793729680c32714cd126690.tar.bz2 |
Use the empty() method to check for emptyness.
Apply fix-its from clang-tidy's readability-container-size-empty
checker.
Diffstat (limited to 'Source/CTest')
-rw-r--r-- | Source/CTest/cmCTestBuildHandler.cxx | 2 | ||||
-rw-r--r-- | Source/CTest/cmCTestCurl.cxx | 14 | ||||
-rw-r--r-- | Source/CTest/cmCTestMemCheckHandler.cxx | 11 | ||||
-rw-r--r-- | Source/CTest/cmCTestReadCustomFilesCommand.cxx | 2 | ||||
-rw-r--r-- | Source/CTest/cmCTestRunScriptCommand.cxx | 2 | ||||
-rw-r--r-- | Source/CTest/cmCTestRunTest.cxx | 5 | ||||
-rw-r--r-- | Source/CTest/cmCTestSleepCommand.cxx | 2 | ||||
-rw-r--r-- | Source/CTest/cmCTestStartCommand.cxx | 2 | ||||
-rw-r--r-- | Source/CTest/cmCTestSubmitHandler.cxx | 4 | ||||
-rw-r--r-- | Source/CTest/cmCTestTestHandler.cxx | 6 | ||||
-rw-r--r-- | Source/CTest/cmParseJacocoCoverage.cxx | 2 |
11 files changed, 27 insertions, 25 deletions
diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx index 7141daf..a4d9dee 100644 --- a/Source/CTest/cmCTestBuildHandler.cxx +++ b/Source/CTest/cmCTestBuildHandler.cxx @@ -790,7 +790,7 @@ int cmCTestBuildHandler::RunMakeCommand(const char* command, int* retVal, // First generate the command and arguments std::vector<std::string> args = cmSystemTools::ParseArguments(command); - if (args.size() < 1) { + if (args.empty()) { return false; } diff --git a/Source/CTest/cmCTestCurl.cxx b/Source/CTest/cmCTestCurl.cxx index 59675dd..4818324 100644 --- a/Source/CTest/cmCTestCurl.cxx +++ b/Source/CTest/cmCTestCurl.cxx @@ -88,10 +88,10 @@ bool cmCTestCurl::InitCurl() if (this->VerifyHostOff) { curl_easy_setopt(this->Curl, CURLOPT_SSL_VERIFYHOST, 0); } - if (this->HTTPProxy.size()) { + if (!this->HTTPProxy.empty()) { curl_easy_setopt(this->Curl, CURLOPT_PROXY, this->HTTPProxy.c_str()); curl_easy_setopt(this->Curl, CURLOPT_PROXYTYPE, this->HTTPProxyType); - if (this->HTTPProxyAuth.size() > 0) { + if (!this->HTTPProxyAuth.empty()) { curl_easy_setopt(this->Curl, CURLOPT_PROXYUSERPWD, this->HTTPProxyAuth.c_str()); } @@ -160,17 +160,17 @@ bool cmCTestCurl::UploadFile(std::string const& local_file, ::curl_easy_setopt(this->Curl, CURLOPT_HTTPHEADER, NULL); ::curl_slist_free_all(headers); - if (responseData.size() > 0) { + if (!responseData.empty()) { response = std::string(responseData.begin(), responseData.end()); cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Curl response: [" << response << "]\n"); } std::string curlDebug; - if (debugData.size() > 0) { + if (!debugData.empty()) { curlDebug = std::string(debugData.begin(), debugData.end()); cmCTestLog(this->CTest, DEBUG, "Curl debug: [" << curlDebug << "]\n"); } - if (response.size() == 0) { + if (response.empty()) { cmCTestLog(this->CTest, ERROR_MESSAGE, "No response from server.\n" << curlDebug); return false; @@ -205,11 +205,11 @@ bool cmCTestCurl::HttpRequest(std::string const& url, CURLcode res = ::curl_easy_perform(this->Curl); - if (responseData.size() > 0) { + if (!responseData.empty()) { response = std::string(responseData.begin(), responseData.end()); cmCTestLog(this->CTest, DEBUG, "Curl response: [" << response << "]\n"); } - if (debugData.size() > 0) { + if (!debugData.empty()) { std::string curlDebug = std::string(debugData.begin(), debugData.end()); cmCTestLog(this->CTest, DEBUG, "Curl debug: [" << curlDebug << "]\n"); } diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx index 5ae98af..f9f7ab7 100644 --- a/Source/CTest/cmCTestMemCheckHandler.cxx +++ b/Source/CTest/cmCTestMemCheckHandler.cxx @@ -499,11 +499,12 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking() // Setup the options std::string memoryTesterOptions; - if (this->CTest->GetCTestConfiguration("MemoryCheckCommandOptions").size()) { + if (!this->CTest->GetCTestConfiguration("MemoryCheckCommandOptions") + .empty()) { memoryTesterOptions = this->CTest->GetCTestConfiguration("MemoryCheckCommandOptions"); - } else if (this->CTest->GetCTestConfiguration("ValgrindCommandOptions") - .size()) { + } else if (!this->CTest->GetCTestConfiguration("ValgrindCommandOptions") + .empty()) { memoryTesterOptions = this->CTest->GetCTestConfiguration("ValgrindCommandOptions"); } @@ -522,8 +523,8 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking() this->MemoryTesterOptions.push_back("--show-reachable=yes"); this->MemoryTesterOptions.push_back("--num-callers=50"); } - if (this->CTest->GetCTestConfiguration("MemoryCheckSuppressionFile") - .size()) { + if (!this->CTest->GetCTestConfiguration("MemoryCheckSuppressionFile") + .empty()) { if (!cmSystemTools::FileExists( this->CTest->GetCTestConfiguration("MemoryCheckSuppressionFile") .c_str())) { diff --git a/Source/CTest/cmCTestReadCustomFilesCommand.cxx b/Source/CTest/cmCTestReadCustomFilesCommand.cxx index 2613c1c..fec23e9 100644 --- a/Source/CTest/cmCTestReadCustomFilesCommand.cxx +++ b/Source/CTest/cmCTestReadCustomFilesCommand.cxx @@ -16,7 +16,7 @@ bool cmCTestReadCustomFilesCommand::InitialPass( std::vector<std::string> const& args, cmExecutionStatus&) { - if (args.size() < 1) { + if (args.empty()) { this->SetError("called with incorrect number of arguments"); return false; } diff --git a/Source/CTest/cmCTestRunScriptCommand.cxx b/Source/CTest/cmCTestRunScriptCommand.cxx index e143d50..6b5e6ed 100644 --- a/Source/CTest/cmCTestRunScriptCommand.cxx +++ b/Source/CTest/cmCTestRunScriptCommand.cxx @@ -16,7 +16,7 @@ bool cmCTestRunScriptCommand::InitialPass(std::vector<std::string> const& args, cmExecutionStatus&) { - if (args.size() < 1) { + if (args.empty()) { this->CTestScriptHandler->RunCurrentScript(); return true; } diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index 9dda865..48582c9 100644 --- a/Source/CTest/cmCTestRunTest.cxx +++ b/Source/CTest/cmCTestRunTest.cxx @@ -207,7 +207,8 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started) } if (res == cmsysProcess_State_Exited) { bool success = !forceFail && - (retVal == 0 || this->TestProperties->RequiredRegularExpressions.size()); + (retVal == 0 || + !this->TestProperties->RequiredRegularExpressions.empty()); if (this->TestProperties->SkipReturnCode >= 0 && this->TestProperties->SkipReturnCode == retVal) { this->TestResult.Status = cmCTestTestHandler::NOT_RUN; @@ -537,7 +538,7 @@ void cmCTestRunTest::ComputeArguments() << " command: " << testCommand << std::endl); // Print any test-specific env vars in verbose mode - if (this->TestProperties->Environment.size()) { + if (!this->TestProperties->Environment.empty()) { cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, this->Index << ": " << "Environment variables: " << std::endl); diff --git a/Source/CTest/cmCTestSleepCommand.cxx b/Source/CTest/cmCTestSleepCommand.cxx index 102a303..a6dd6bc 100644 --- a/Source/CTest/cmCTestSleepCommand.cxx +++ b/Source/CTest/cmCTestSleepCommand.cxx @@ -17,7 +17,7 @@ bool cmCTestSleepCommand::InitialPass(std::vector<std::string> const& args, cmExecutionStatus&) { - if (args.size() < 1) { + if (args.empty()) { this->SetError("called with incorrect number of arguments"); return false; } diff --git a/Source/CTest/cmCTestStartCommand.cxx b/Source/CTest/cmCTestStartCommand.cxx index d561393..99d431a 100644 --- a/Source/CTest/cmCTestStartCommand.cxx +++ b/Source/CTest/cmCTestStartCommand.cxx @@ -25,7 +25,7 @@ cmCTestStartCommand::cmCTestStartCommand() bool cmCTestStartCommand::InitialPass(std::vector<std::string> const& args, cmExecutionStatus&) { - if (args.size() < 1) { + if (args.empty()) { this->SetError("called with incorrect number of arguments"); return false; } diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index f373348..155294e 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -999,12 +999,12 @@ void cmCTestSubmitHandler::ConstructCDashURL(std::string& dropMethod, dropMethod = this->CTest->GetCTestConfiguration("DropMethod"); url = dropMethod; url += "://"; - if (this->CTest->GetCTestConfiguration("DropSiteUser").size() > 0) { + if (!this->CTest->GetCTestConfiguration("DropSiteUser").empty()) { url += this->CTest->GetCTestConfiguration("DropSiteUser"); cmCTestOptionalLog( this->CTest, HANDLER_OUTPUT, this->CTest->GetCTestConfiguration("DropSiteUser").c_str(), this->Quiet); - if (this->CTest->GetCTestConfiguration("DropSitePassword").size() > 0) { + if (!this->CTest->GetCTestConfiguration("DropSitePassword").empty()) { url += ":" + this->CTest->GetCTestConfiguration("DropSitePassword"); cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, ":******", this->Quiet); } diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 20ef693..b461f97 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -69,7 +69,7 @@ public: bool cmCTestSubdirCommand::InitialPass(std::vector<std::string> const& args, cmExecutionStatus&) { - if (args.size() < 1) { + if (args.empty()) { this->SetError("called with incorrect number of arguments"); return false; } @@ -150,7 +150,7 @@ public: bool cmCTestAddSubdirectoryCommand::InitialPass( std::vector<std::string> const& args, cmExecutionStatus&) { - if (args.size() < 1) { + if (args.empty()) { this->SetError("called with incorrect number of arguments"); return false; } @@ -1125,7 +1125,7 @@ void cmCTestTestHandler::AttachFiles(cmXMLWriter& xml, cmCTestTestResult* result) { if (result->Status != cmCTestTestHandler::COMPLETED && - result->Properties->AttachOnFail.size()) { + !result->Properties->AttachOnFail.empty()) { result->Properties->AttachedFiles.insert( result->Properties->AttachedFiles.end(), result->Properties->AttachOnFail.begin(), diff --git a/Source/CTest/cmParseJacocoCoverage.cxx b/Source/CTest/cmParseJacocoCoverage.cxx index 335535d..e456f39 100644 --- a/Source/CTest/cmParseJacocoCoverage.cxx +++ b/Source/CTest/cmParseJacocoCoverage.cxx @@ -111,7 +111,7 @@ protected: gl.RecurseThroughSymlinksOn(); gl.FindFiles(packageGlob); std::vector<std::string> const& files = gl.GetFiles(); - if (files.size() == 0) { + if (files.empty()) { return false; } |