diff options
author | Brad King <brad.king@kitware.com> | 2016-06-03 14:45:52 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2016-06-03 14:45:52 (GMT) |
commit | 3d6638471a87c2d5f568097d5bda6e7021a45a38 (patch) | |
tree | 388493c0a3001b8d025faebb304491d2f7ab0601 | |
parent | e3f763765998b25707c364151a270e70d16e1744 (diff) | |
parent | c6220de27605f33b2793729680c32714cd126690 (diff) | |
download | CMake-3d6638471a87c2d5f568097d5bda6e7021a45a38.zip CMake-3d6638471a87c2d5f568097d5bda6e7021a45a38.tar.gz CMake-3d6638471a87c2d5f568097d5bda6e7021a45a38.tar.bz2 |
Merge topic 'size-empty'
c6220de2 Use the empty() method to check for emptyness.
-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 | ||||
-rw-r--r-- | Source/cmArchiveWrite.cxx | 2 | ||||
-rw-r--r-- | Source/cmCTest.cxx | 4 | ||||
-rw-r--r-- | Source/cmExtraCodeBlocksGenerator.cxx | 4 | ||||
-rw-r--r-- | Source/cmMakefileTargetGenerator.cxx | 2 | ||||
-rw-r--r-- | Source/cmSystemTools.cxx | 2 |
16 files changed, 34 insertions, 32 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 f8ffd43..5b5caea 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 32975df..015b908 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -992,12 +992,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 55a6518..f461ca8 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; } diff --git a/Source/cmArchiveWrite.cxx b/Source/cmArchiveWrite.cxx index a0150ec..235cf88 100644 --- a/Source/cmArchiveWrite.cxx +++ b/Source/cmArchiveWrite.cxx @@ -255,7 +255,7 @@ bool cmArchiveWrite::AddFile(const char* file, size_t skip, const char* prefix) archive_entry_set_gid(e, this->Gid.Get()); } - if (this->Uname.size() && this->Gname.size()) { + if (!this->Uname.empty() && !this->Gname.empty()) { archive_entry_set_uname(e, this->Uname.c_str()); archive_entry_set_gname(e, this->Gname.c_str()); } diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index bc36c5a..6e08932 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -1020,7 +1020,7 @@ int cmCTest::RunMakeCommand(const char* command, std::string& output, // First generate the command and arguments std::vector<std::string> args = cmSystemTools::ParseArguments(command); - if (args.size() < 1) { + if (args.empty()) { return false; } @@ -2525,7 +2525,7 @@ bool cmCTest::RunCommand(const char* command, std::string* stdOut, { std::vector<std::string> args = cmSystemTools::ParseArguments(command); - if (args.size() < 1) { + if (args.empty()) { return false; } diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index 40cff78..8c656b9 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -248,7 +248,7 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile( // We don't want paths with CMakeFiles in them // or do we? // In speedcrunch those where purely internal - if (splitted.size() >= 1 && + if (!splitted.empty() && relative.find("CMakeFiles") == std::string::npos) { tree.InsertPath(splitted, 1, fileName); } @@ -729,7 +729,7 @@ std::string cmExtraCodeBlocksGenerator::BuildMakeCommand( const std::string& makeFlags) { std::string command = make; - if (makeFlags.size() > 0) { + if (!makeFlags.empty()) { command += " "; command += makeFlags; } diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 93f9e49..3086bb1 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -848,7 +848,7 @@ bool cmMakefileTargetGenerator::WriteMakeRule( const std::vector<std::string>& commands, bool in_help) { bool symbolic = false; - if (outputs.size() == 0) { + if (outputs.empty()) { return symbolic; } diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 08e0c30..10c68d1 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -702,7 +702,7 @@ bool cmSystemTools::RunSingleCommand(const char* command, std::vector<std::string> args = cmSystemTools::ParseArguments(command); - if (args.size() < 1) { + if (args.empty()) { return false; } return cmSystemTools::RunSingleCommand(args, captureStdOut, captureStdErr, |