Use the empty() method to check for emptyness.
Apply fix-its from clang-tidy's readability-container-size-empty checker.
This commit is contained in:
parent
9ca8c7a99f
commit
c6220de276
|
@ -790,7 +790,7 @@ int cmCTestBuildHandler::RunMakeCommand(const char* command, int* retVal,
|
||||||
// First generate the command and arguments
|
// First generate the command and arguments
|
||||||
std::vector<std::string> args = cmSystemTools::ParseArguments(command);
|
std::vector<std::string> args = cmSystemTools::ParseArguments(command);
|
||||||
|
|
||||||
if (args.size() < 1) {
|
if (args.empty()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -88,10 +88,10 @@ bool cmCTestCurl::InitCurl()
|
||||||
if (this->VerifyHostOff) {
|
if (this->VerifyHostOff) {
|
||||||
curl_easy_setopt(this->Curl, CURLOPT_SSL_VERIFYHOST, 0);
|
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_PROXY, this->HTTPProxy.c_str());
|
||||||
curl_easy_setopt(this->Curl, CURLOPT_PROXYTYPE, this->HTTPProxyType);
|
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,
|
curl_easy_setopt(this->Curl, CURLOPT_PROXYUSERPWD,
|
||||||
this->HTTPProxyAuth.c_str());
|
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_easy_setopt(this->Curl, CURLOPT_HTTPHEADER, NULL);
|
||||||
::curl_slist_free_all(headers);
|
::curl_slist_free_all(headers);
|
||||||
|
|
||||||
if (responseData.size() > 0) {
|
if (!responseData.empty()) {
|
||||||
response = std::string(responseData.begin(), responseData.end());
|
response = std::string(responseData.begin(), responseData.end());
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Curl response: ["
|
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Curl response: ["
|
||||||
<< response << "]\n");
|
<< response << "]\n");
|
||||||
}
|
}
|
||||||
std::string curlDebug;
|
std::string curlDebug;
|
||||||
if (debugData.size() > 0) {
|
if (!debugData.empty()) {
|
||||||
curlDebug = std::string(debugData.begin(), debugData.end());
|
curlDebug = std::string(debugData.begin(), debugData.end());
|
||||||
cmCTestLog(this->CTest, DEBUG, "Curl debug: [" << curlDebug << "]\n");
|
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"
|
cmCTestLog(this->CTest, ERROR_MESSAGE, "No response from server.\n"
|
||||||
<< curlDebug);
|
<< curlDebug);
|
||||||
return false;
|
return false;
|
||||||
|
@ -205,11 +205,11 @@ bool cmCTestCurl::HttpRequest(std::string const& url,
|
||||||
|
|
||||||
CURLcode res = ::curl_easy_perform(this->Curl);
|
CURLcode res = ::curl_easy_perform(this->Curl);
|
||||||
|
|
||||||
if (responseData.size() > 0) {
|
if (!responseData.empty()) {
|
||||||
response = std::string(responseData.begin(), responseData.end());
|
response = std::string(responseData.begin(), responseData.end());
|
||||||
cmCTestLog(this->CTest, DEBUG, "Curl response: [" << response << "]\n");
|
cmCTestLog(this->CTest, DEBUG, "Curl response: [" << response << "]\n");
|
||||||
}
|
}
|
||||||
if (debugData.size() > 0) {
|
if (!debugData.empty()) {
|
||||||
std::string curlDebug = std::string(debugData.begin(), debugData.end());
|
std::string curlDebug = std::string(debugData.begin(), debugData.end());
|
||||||
cmCTestLog(this->CTest, DEBUG, "Curl debug: [" << curlDebug << "]\n");
|
cmCTestLog(this->CTest, DEBUG, "Curl debug: [" << curlDebug << "]\n");
|
||||||
}
|
}
|
||||||
|
|
|
@ -499,11 +499,12 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking()
|
||||||
|
|
||||||
// Setup the options
|
// Setup the options
|
||||||
std::string memoryTesterOptions;
|
std::string memoryTesterOptions;
|
||||||
if (this->CTest->GetCTestConfiguration("MemoryCheckCommandOptions").size()) {
|
if (!this->CTest->GetCTestConfiguration("MemoryCheckCommandOptions")
|
||||||
|
.empty()) {
|
||||||
memoryTesterOptions =
|
memoryTesterOptions =
|
||||||
this->CTest->GetCTestConfiguration("MemoryCheckCommandOptions");
|
this->CTest->GetCTestConfiguration("MemoryCheckCommandOptions");
|
||||||
} else if (this->CTest->GetCTestConfiguration("ValgrindCommandOptions")
|
} else if (!this->CTest->GetCTestConfiguration("ValgrindCommandOptions")
|
||||||
.size()) {
|
.empty()) {
|
||||||
memoryTesterOptions =
|
memoryTesterOptions =
|
||||||
this->CTest->GetCTestConfiguration("ValgrindCommandOptions");
|
this->CTest->GetCTestConfiguration("ValgrindCommandOptions");
|
||||||
}
|
}
|
||||||
|
@ -522,8 +523,8 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking()
|
||||||
this->MemoryTesterOptions.push_back("--show-reachable=yes");
|
this->MemoryTesterOptions.push_back("--show-reachable=yes");
|
||||||
this->MemoryTesterOptions.push_back("--num-callers=50");
|
this->MemoryTesterOptions.push_back("--num-callers=50");
|
||||||
}
|
}
|
||||||
if (this->CTest->GetCTestConfiguration("MemoryCheckSuppressionFile")
|
if (!this->CTest->GetCTestConfiguration("MemoryCheckSuppressionFile")
|
||||||
.size()) {
|
.empty()) {
|
||||||
if (!cmSystemTools::FileExists(
|
if (!cmSystemTools::FileExists(
|
||||||
this->CTest->GetCTestConfiguration("MemoryCheckSuppressionFile")
|
this->CTest->GetCTestConfiguration("MemoryCheckSuppressionFile")
|
||||||
.c_str())) {
|
.c_str())) {
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
bool cmCTestReadCustomFilesCommand::InitialPass(
|
bool cmCTestReadCustomFilesCommand::InitialPass(
|
||||||
std::vector<std::string> const& args, cmExecutionStatus&)
|
std::vector<std::string> const& args, cmExecutionStatus&)
|
||||||
{
|
{
|
||||||
if (args.size() < 1) {
|
if (args.empty()) {
|
||||||
this->SetError("called with incorrect number of arguments");
|
this->SetError("called with incorrect number of arguments");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
bool cmCTestRunScriptCommand::InitialPass(std::vector<std::string> const& args,
|
bool cmCTestRunScriptCommand::InitialPass(std::vector<std::string> const& args,
|
||||||
cmExecutionStatus&)
|
cmExecutionStatus&)
|
||||||
{
|
{
|
||||||
if (args.size() < 1) {
|
if (args.empty()) {
|
||||||
this->CTestScriptHandler->RunCurrentScript();
|
this->CTestScriptHandler->RunCurrentScript();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -207,7 +207,8 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started)
|
||||||
}
|
}
|
||||||
if (res == cmsysProcess_State_Exited) {
|
if (res == cmsysProcess_State_Exited) {
|
||||||
bool success = !forceFail &&
|
bool success = !forceFail &&
|
||||||
(retVal == 0 || this->TestProperties->RequiredRegularExpressions.size());
|
(retVal == 0 ||
|
||||||
|
!this->TestProperties->RequiredRegularExpressions.empty());
|
||||||
if (this->TestProperties->SkipReturnCode >= 0 &&
|
if (this->TestProperties->SkipReturnCode >= 0 &&
|
||||||
this->TestProperties->SkipReturnCode == retVal) {
|
this->TestProperties->SkipReturnCode == retVal) {
|
||||||
this->TestResult.Status = cmCTestTestHandler::NOT_RUN;
|
this->TestResult.Status = cmCTestTestHandler::NOT_RUN;
|
||||||
|
@ -537,7 +538,7 @@ void cmCTestRunTest::ComputeArguments()
|
||||||
<< " command: " << testCommand << std::endl);
|
<< " command: " << testCommand << std::endl);
|
||||||
|
|
||||||
// Print any test-specific env vars in verbose mode
|
// 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
|
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, this->Index
|
||||||
<< ": "
|
<< ": "
|
||||||
<< "Environment variables: " << std::endl);
|
<< "Environment variables: " << std::endl);
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
bool cmCTestSleepCommand::InitialPass(std::vector<std::string> const& args,
|
bool cmCTestSleepCommand::InitialPass(std::vector<std::string> const& args,
|
||||||
cmExecutionStatus&)
|
cmExecutionStatus&)
|
||||||
{
|
{
|
||||||
if (args.size() < 1) {
|
if (args.empty()) {
|
||||||
this->SetError("called with incorrect number of arguments");
|
this->SetError("called with incorrect number of arguments");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ cmCTestStartCommand::cmCTestStartCommand()
|
||||||
bool cmCTestStartCommand::InitialPass(std::vector<std::string> const& args,
|
bool cmCTestStartCommand::InitialPass(std::vector<std::string> const& args,
|
||||||
cmExecutionStatus&)
|
cmExecutionStatus&)
|
||||||
{
|
{
|
||||||
if (args.size() < 1) {
|
if (args.empty()) {
|
||||||
this->SetError("called with incorrect number of arguments");
|
this->SetError("called with incorrect number of arguments");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -999,12 +999,12 @@ void cmCTestSubmitHandler::ConstructCDashURL(std::string& dropMethod,
|
||||||
dropMethod = this->CTest->GetCTestConfiguration("DropMethod");
|
dropMethod = this->CTest->GetCTestConfiguration("DropMethod");
|
||||||
url = dropMethod;
|
url = dropMethod;
|
||||||
url += "://";
|
url += "://";
|
||||||
if (this->CTest->GetCTestConfiguration("DropSiteUser").size() > 0) {
|
if (!this->CTest->GetCTestConfiguration("DropSiteUser").empty()) {
|
||||||
url += this->CTest->GetCTestConfiguration("DropSiteUser");
|
url += this->CTest->GetCTestConfiguration("DropSiteUser");
|
||||||
cmCTestOptionalLog(
|
cmCTestOptionalLog(
|
||||||
this->CTest, HANDLER_OUTPUT,
|
this->CTest, HANDLER_OUTPUT,
|
||||||
this->CTest->GetCTestConfiguration("DropSiteUser").c_str(), this->Quiet);
|
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");
|
url += ":" + this->CTest->GetCTestConfiguration("DropSitePassword");
|
||||||
cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, ":******", this->Quiet);
|
cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, ":******", this->Quiet);
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,7 +69,7 @@ public:
|
||||||
bool cmCTestSubdirCommand::InitialPass(std::vector<std::string> const& args,
|
bool cmCTestSubdirCommand::InitialPass(std::vector<std::string> const& args,
|
||||||
cmExecutionStatus&)
|
cmExecutionStatus&)
|
||||||
{
|
{
|
||||||
if (args.size() < 1) {
|
if (args.empty()) {
|
||||||
this->SetError("called with incorrect number of arguments");
|
this->SetError("called with incorrect number of arguments");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -150,7 +150,7 @@ public:
|
||||||
bool cmCTestAddSubdirectoryCommand::InitialPass(
|
bool cmCTestAddSubdirectoryCommand::InitialPass(
|
||||||
std::vector<std::string> const& args, cmExecutionStatus&)
|
std::vector<std::string> const& args, cmExecutionStatus&)
|
||||||
{
|
{
|
||||||
if (args.size() < 1) {
|
if (args.empty()) {
|
||||||
this->SetError("called with incorrect number of arguments");
|
this->SetError("called with incorrect number of arguments");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1125,7 +1125,7 @@ void cmCTestTestHandler::AttachFiles(cmXMLWriter& xml,
|
||||||
cmCTestTestResult* result)
|
cmCTestTestResult* result)
|
||||||
{
|
{
|
||||||
if (result->Status != cmCTestTestHandler::COMPLETED &&
|
if (result->Status != cmCTestTestHandler::COMPLETED &&
|
||||||
result->Properties->AttachOnFail.size()) {
|
!result->Properties->AttachOnFail.empty()) {
|
||||||
result->Properties->AttachedFiles.insert(
|
result->Properties->AttachedFiles.insert(
|
||||||
result->Properties->AttachedFiles.end(),
|
result->Properties->AttachedFiles.end(),
|
||||||
result->Properties->AttachOnFail.begin(),
|
result->Properties->AttachOnFail.begin(),
|
||||||
|
|
|
@ -111,7 +111,7 @@ protected:
|
||||||
gl.RecurseThroughSymlinksOn();
|
gl.RecurseThroughSymlinksOn();
|
||||||
gl.FindFiles(packageGlob);
|
gl.FindFiles(packageGlob);
|
||||||
std::vector<std::string> const& files = gl.GetFiles();
|
std::vector<std::string> const& files = gl.GetFiles();
|
||||||
if (files.size() == 0) {
|
if (files.empty()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -255,7 +255,7 @@ bool cmArchiveWrite::AddFile(const char* file, size_t skip, const char* prefix)
|
||||||
archive_entry_set_gid(e, this->Gid.Get());
|
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_uname(e, this->Uname.c_str());
|
||||||
archive_entry_set_gname(e, this->Gname.c_str());
|
archive_entry_set_gname(e, this->Gname.c_str());
|
||||||
}
|
}
|
||||||
|
|
|
@ -1020,7 +1020,7 @@ int cmCTest::RunMakeCommand(const char* command, std::string& output,
|
||||||
// First generate the command and arguments
|
// First generate the command and arguments
|
||||||
std::vector<std::string> args = cmSystemTools::ParseArguments(command);
|
std::vector<std::string> args = cmSystemTools::ParseArguments(command);
|
||||||
|
|
||||||
if (args.size() < 1) {
|
if (args.empty()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2525,7 +2525,7 @@ bool cmCTest::RunCommand(const char* command, std::string* stdOut,
|
||||||
{
|
{
|
||||||
std::vector<std::string> args = cmSystemTools::ParseArguments(command);
|
std::vector<std::string> args = cmSystemTools::ParseArguments(command);
|
||||||
|
|
||||||
if (args.size() < 1) {
|
if (args.empty()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -248,7 +248,7 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile(
|
||||||
// We don't want paths with CMakeFiles in them
|
// We don't want paths with CMakeFiles in them
|
||||||
// or do we?
|
// or do we?
|
||||||
// In speedcrunch those where purely internal
|
// In speedcrunch those where purely internal
|
||||||
if (splitted.size() >= 1 &&
|
if (!splitted.empty() &&
|
||||||
relative.find("CMakeFiles") == std::string::npos) {
|
relative.find("CMakeFiles") == std::string::npos) {
|
||||||
tree.InsertPath(splitted, 1, fileName);
|
tree.InsertPath(splitted, 1, fileName);
|
||||||
}
|
}
|
||||||
|
@ -729,7 +729,7 @@ std::string cmExtraCodeBlocksGenerator::BuildMakeCommand(
|
||||||
const std::string& makeFlags)
|
const std::string& makeFlags)
|
||||||
{
|
{
|
||||||
std::string command = make;
|
std::string command = make;
|
||||||
if (makeFlags.size() > 0) {
|
if (!makeFlags.empty()) {
|
||||||
command += " ";
|
command += " ";
|
||||||
command += makeFlags;
|
command += makeFlags;
|
||||||
}
|
}
|
||||||
|
|
|
@ -848,7 +848,7 @@ bool cmMakefileTargetGenerator::WriteMakeRule(
|
||||||
const std::vector<std::string>& commands, bool in_help)
|
const std::vector<std::string>& commands, bool in_help)
|
||||||
{
|
{
|
||||||
bool symbolic = false;
|
bool symbolic = false;
|
||||||
if (outputs.size() == 0) {
|
if (outputs.empty()) {
|
||||||
return symbolic;
|
return symbolic;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -702,7 +702,7 @@ bool cmSystemTools::RunSingleCommand(const char* command,
|
||||||
|
|
||||||
std::vector<std::string> args = cmSystemTools::ParseArguments(command);
|
std::vector<std::string> args = cmSystemTools::ParseArguments(command);
|
||||||
|
|
||||||
if (args.size() < 1) {
|
if (args.empty()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return cmSystemTools::RunSingleCommand(args, captureStdOut, captureStdErr,
|
return cmSystemTools::RunSingleCommand(args, captureStdOut, captureStdErr,
|
||||||
|
|
Loading…
Reference in New Issue