summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorVitaly Stakhovsky <vvs31415@gitlab.org>2018-08-07 15:27:20 (GMT)
committerBrad King <brad.king@kitware.com>2018-08-07 19:28:24 (GMT)
commit69ca85cc7faf937d6d9d1dc1a27e062cd7765b1f (patch)
treef323fcadf3c4e11227a0eea006ae7bfa17e8d26c /Source
parentd7a52f8c24a29ff7f64b00566b646f2d125d4ac0 (diff)
downloadCMake-69ca85cc7faf937d6d9d1dc1a27e062cd7765b1f.zip
CMake-69ca85cc7faf937d6d9d1dc1a27e062cd7765b1f.tar.gz
CMake-69ca85cc7faf937d6d9d1dc1a27e062cd7765b1f.tar.bz2
Remove unnecessary c_str() in RegularExpression::find calls
Diffstat (limited to 'Source')
-rw-r--r--Source/CPack/cmCPackGenerator.cxx2
-rw-r--r--Source/CTest/cmCTestBuildHandler.cxx2
-rw-r--r--Source/CTest/cmCTestCoverageHandler.cxx16
-rw-r--r--Source/CTest/cmCTestLaunch.cxx2
-rw-r--r--Source/CTest/cmCTestRunTest.cxx10
-rw-r--r--Source/CTest/cmCTestTestHandler.cxx6
-rw-r--r--Source/cmBuildNameCommand.cxx4
-rw-r--r--Source/cmDependsC.cxx8
-rw-r--r--Source/cmExportCommand.cxx2
-rw-r--r--Source/cmExtraEclipseCDT4Generator.cxx4
-rw-r--r--Source/cmFileCommand.cxx8
-rw-r--r--Source/cmFindPackageCommand.cxx2
-rw-r--r--Source/cmGeneratorExpressionNode.cxx2
-rw-r--r--Source/cmGeneratorTarget.cxx2
-rw-r--r--Source/cmLocalGenerator.cxx2
-rw-r--r--Source/cmOutputRequiredFilesCommand.cxx3
-rw-r--r--Source/cmStringCommand.cxx2
-rw-r--r--Source/cmUseMangledMesaCommand.cxx6
-rw-r--r--Source/cmake.cxx2
19 files changed, 42 insertions, 43 deletions
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index 7014676..3cb6dde 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -369,7 +369,7 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories(
inFile += '/';
}
for (cmsys::RegularExpression& reg : ignoreFilesRegex) {
- if (reg.find(inFile.c_str())) {
+ if (reg.find(inFile)) {
cmCPackLogger(cmCPackLog::LOG_VERBOSE,
"Ignore file: " << inFile << std::endl);
skip = true;
diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx
index 8527d54..74af85c 100644
--- a/Source/CTest/cmCTestBuildHandler.cxx
+++ b/Source/CTest/cmCTestBuildHandler.cxx
@@ -589,7 +589,7 @@ void cmCTestBuildHandler::GenerateXMLLogScraped(cmXMLWriter& xml)
for (cmCTestCompileErrorWarningRex& rit :
this->ErrorWarningFileLineRegex) {
cmsys::RegularExpression* re = &rit.RegularExpression;
- if (re->find(cm->Text.c_str())) {
+ if (re->find(cm->Text)) {
cm->SourceFile = re->match(rit.FileIndex);
// At this point we need to make this->SourceFile relative to
// the source root of the project, so cvs links will work
diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx
index 43a2bae..1d9a5f7 100644
--- a/Source/CTest/cmCTestCoverageHandler.cxx
+++ b/Source/CTest/cmCTestCoverageHandler.cxx
@@ -1075,7 +1075,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
if (line.empty()) {
// Ignore empty line; probably style 2
- } else if (st1re1.find(line.c_str())) {
+ } else if (st1re1.find(line)) {
if (gcovStyle == 0) {
gcovStyle = 1;
}
@@ -1088,7 +1088,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
actualSourceFile.clear();
sourceFile = st1re1.match(2);
- } else if (st1re2.find(line.c_str())) {
+ } else if (st1re2.find(line)) {
if (gcovStyle == 0) {
gcovStyle = 1;
}
@@ -1100,7 +1100,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
}
gcovFile = st1re2.match(1);
- } else if (st2re1.find(line.c_str())) {
+ } else if (st2re1.find(line)) {
if (gcovStyle == 0) {
gcovStyle = 2;
}
@@ -1113,7 +1113,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
actualSourceFile.clear();
sourceFile = st2re1.match(1);
- } else if (st2re2.find(line.c_str())) {
+ } else if (st2re2.find(line)) {
if (gcovStyle == 0) {
gcovStyle = 2;
}
@@ -1123,7 +1123,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
cont->Error++;
break;
}
- } else if (st2re3.find(line.c_str())) {
+ } else if (st2re3.find(line)) {
if (gcovStyle == 0) {
gcovStyle = 2;
}
@@ -1135,7 +1135,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
}
gcovFile = st2re3.match(2);
- } else if (st2re4.find(line.c_str())) {
+ } else if (st2re4.find(line)) {
if (gcovStyle == 0) {
gcovStyle = 2;
}
@@ -1150,7 +1150,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
"Warning: " << st2re4.match(1)
<< " had unexpected EOF" << std::endl,
this->Quiet);
- } else if (st2re5.find(line.c_str())) {
+ } else if (st2re5.find(line)) {
if (gcovStyle == 0) {
gcovStyle = 2;
}
@@ -1165,7 +1165,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
"Warning: Cannot open file: " << st2re5.match(1)
<< std::endl,
this->Quiet);
- } else if (st2re6.find(line.c_str())) {
+ } else if (st2re6.find(line)) {
if (gcovStyle == 0) {
gcovStyle = 2;
}
diff --git a/Source/CTest/cmCTestLaunch.cxx b/Source/CTest/cmCTestLaunch.cxx
index 0bffde3..bbe0ad3 100644
--- a/Source/CTest/cmCTestLaunch.cxx
+++ b/Source/CTest/cmCTestLaunch.cxx
@@ -584,7 +584,7 @@ bool cmCTestLaunch::Match(std::string const& line,
std::vector<cmsys::RegularExpression>& regexps)
{
for (cmsys::RegularExpression& r : regexps) {
- if (r.find(line.c_str())) {
+ if (r.find(line)) {
return true;
}
}
diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx
index 927797a..ef0a49d 100644
--- a/Source/CTest/cmCTestRunTest.cxx
+++ b/Source/CTest/cmCTestRunTest.cxx
@@ -49,7 +49,7 @@ void cmCTestRunTest::CheckOutput(std::string const& line)
// Check for TIMEOUT_AFTER_MATCH property.
if (!this->TestProperties->TimeoutRegularExpressions.empty()) {
for (auto& reg : this->TestProperties->TimeoutRegularExpressions) {
- if (reg.first.find(this->ProcessOutput.c_str())) {
+ if (reg.first.find(this->ProcessOutput)) {
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
this->GetIndex()
<< ": "
@@ -148,7 +148,7 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started)
this->FailedDependencies.empty()) {
bool found = false;
for (auto& pass : this->TestProperties->RequiredRegularExpressions) {
- if (pass.first.find(this->ProcessOutput.c_str())) {
+ if (pass.first.find(this->ProcessOutput)) {
found = true;
reason = "Required regular expression found.";
break;
@@ -168,7 +168,7 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started)
if (!this->TestProperties->ErrorRegularExpressions.empty() &&
this->FailedDependencies.empty()) {
for (auto& pass : this->TestProperties->ErrorRegularExpressions) {
- if (pass.first.find(this->ProcessOutput.c_str())) {
+ if (pass.first.find(this->ProcessOutput)) {
reason = "Error regular expression found in output.";
reason += " Regex=[";
reason += pass.second;
@@ -616,10 +616,10 @@ void cmCTestRunTest::DartProcessing()
{
if (!this->ProcessOutput.empty() &&
this->ProcessOutput.find("<DartMeasurement") != std::string::npos) {
- if (this->TestHandler->DartStuff.find(this->ProcessOutput.c_str())) {
+ if (this->TestHandler->DartStuff.find(this->ProcessOutput)) {
this->TestResult.DartString = this->TestHandler->DartStuff.match(1);
// keep searching and replacing until none are left
- while (this->TestHandler->DartStuff1.find(this->ProcessOutput.c_str())) {
+ while (this->TestHandler->DartStuff1.find(this->ProcessOutput)) {
// replace the exact match for the string
cmSystemTools::ReplaceString(
this->ProcessOutput, this->TestHandler->DartStuff1.match(1).c_str(),
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index 91b92a3..d1d8d08 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -2310,7 +2310,7 @@ bool cmCTestTestHandler::AddTest(const std::vector<std::string>& args)
this->Quiet);
if (this->UseExcludeRegExpFlag && this->UseExcludeRegExpFirst &&
- this->ExcludeTestsRegularExpression.find(testname.c_str())) {
+ this->ExcludeTestsRegularExpression.find(testname)) {
return true;
}
if (this->MemCheck) {
@@ -2365,10 +2365,10 @@ bool cmCTestTestHandler::AddTest(const std::vector<std::string>& args)
test.SkipReturnCode = -1;
test.PreviousRuns = 0;
if (this->UseIncludeRegExpFlag &&
- !this->IncludeTestsRegularExpression.find(testname.c_str())) {
+ !this->IncludeTestsRegularExpression.find(testname)) {
test.IsInBasedOnREOptions = false;
} else if (this->UseExcludeRegExpFlag && !this->UseExcludeRegExpFirst &&
- this->ExcludeTestsRegularExpression.find(testname.c_str())) {
+ this->ExcludeTestsRegularExpression.find(testname)) {
test.IsInBasedOnREOptions = false;
}
this->TestList.push_back(test);
diff --git a/Source/cmBuildNameCommand.cxx b/Source/cmBuildNameCommand.cxx
index 5f54338..ddff686 100644
--- a/Source/cmBuildNameCommand.cxx
+++ b/Source/cmBuildNameCommand.cxx
@@ -40,8 +40,8 @@ bool cmBuildNameCommand::InitialPass(std::vector<std::string> const& args,
cmSystemTools::RunSingleCommand("uname -a", &buildname, &buildname);
if (!buildname.empty()) {
std::string RegExp = "([^ ]*) [^ ]* ([^ ]*) ";
- cmsys::RegularExpression reg(RegExp.c_str());
- if (reg.find(buildname.c_str())) {
+ cmsys::RegularExpression reg(RegExp);
+ if (reg.find(buildname)) {
buildname = reg.match(1) + "-" + reg.match(2);
}
}
diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx
index 34c0e94..f7dd33b 100644
--- a/Source/cmDependsC.cxx
+++ b/Source/cmDependsC.cxx
@@ -174,7 +174,7 @@ bool cmDependsC::WriteDependencies(const std::set<std::string>& sources,
// Complain if the file cannot be found and matches the complain
// regex.
if (fullName.empty() &&
- this->IncludeRegexComplain.find(current.FileName.c_str())) {
+ this->IncludeRegexComplain.find(current.FileName)) {
cmSystemTools::Error("Cannot find file \"", current.FileName.c_str(),
"\".");
return false;
@@ -359,7 +359,7 @@ void cmDependsC::Scan(std::istream& is, const char* directory,
}
// Match include directives.
- if (this->IncludeRegexLine.find(line.c_str())) {
+ if (this->IncludeRegexLine.find(line)) {
// Get the file being included.
UnscannedEntry entry;
entry.FileName = this->IncludeRegexLine.match(2);
@@ -383,7 +383,7 @@ void cmDependsC::Scan(std::istream& is, const char* directory,
// file their own directory by simply using "filename.h" (#12619)
// This kind of problem will be fixed when a more
// preprocessor-like implementation of this scanner is created.
- if (this->IncludeRegexScan.find(entry.FileName.c_str())) {
+ if (this->IncludeRegexScan.find(entry.FileName)) {
newCacheEntry->UnscannedEntries.push_back(entry);
if (this->Encountered.find(entry.FileName) ==
this->Encountered.end()) {
@@ -449,7 +449,7 @@ void cmDependsC::ParseTransform(std::string const& xform)
void cmDependsC::TransformLine(std::string& line)
{
// Check for a transform rule match. Return if none.
- if (!this->IncludeRegexTransform.find(line.c_str())) {
+ if (!this->IncludeRegexTransform.find(line)) {
return;
}
TransformRulesType::const_iterator tri =
diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx
index 4e1d771..8ac9437 100644
--- a/Source/cmExportCommand.cxx
+++ b/Source/cmExportCommand.cxx
@@ -237,7 +237,7 @@ bool cmExportCommand::HandlePackage(std::vector<std::string> const& args)
}
const char* packageExpr = "^[A-Za-z0-9_.-]+$";
cmsys::RegularExpression packageRegex(packageExpr);
- if (!packageRegex.find(package.c_str())) {
+ if (!packageRegex.find(package)) {
std::ostringstream e;
e << "PACKAGE given invalid package name \"" << package << "\". "
<< "Package names must match \"" << packageExpr << "\".";
diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx
index 14448f5..6ee1273 100644
--- a/Source/cmExtraEclipseCDT4Generator.cxx
+++ b/Source/cmExtraEclipseCDT4Generator.cxx
@@ -98,7 +98,7 @@ void cmExtraEclipseCDT4Generator::Generate()
std::string eclipseVersion = mf->GetSafeDefinition("CMAKE_ECLIPSE_VERSION");
cmsys::RegularExpression regex(".*([0-9]+\\.[0-9]+).*");
- if (regex.find(eclipseVersion.c_str())) {
+ if (regex.find(eclipseVersion)) {
unsigned int majorVersion = 0;
unsigned int minorVersion = 0;
int res =
@@ -555,7 +555,7 @@ void cmExtraEclipseCDT4Generator::AppendIncludeDirectories(
// Frameworks/ part has to be stripped
// /System/Library/Frameworks/GLUT.framework/Headers
cmsys::RegularExpression frameworkRx("(.+/Frameworks)/.+\\.framework/");
- if (frameworkRx.find(dir.c_str())) {
+ if (frameworkRx.find(dir)) {
dir = frameworkRx.match(1);
}
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 402ceb2..0c80319 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -663,7 +663,7 @@ bool cmFileCommand::HandleStringsCommand(std::vector<std::string> const& args)
// The current line has been terminated. Check if the current
// string matches the requirements. The length may now be as
// low as zero since blank lines are allowed.
- if (s.length() >= minlen && (!have_regex || regex.find(s.c_str()))) {
+ if (s.length() >= minlen && (!have_regex || regex.find(s))) {
output_size += static_cast<int>(s.size()) + 1;
if (limit_output >= 0 && output_size >= limit_output) {
s.clear();
@@ -679,7 +679,7 @@ bool cmFileCommand::HandleStringsCommand(std::vector<std::string> const& args)
// string matches the requirements. We require that the length
// be at least one no matter what the user specified.
if (s.length() >= minlen && !s.empty() &&
- (!have_regex || regex.find(s.c_str()))) {
+ (!have_regex || regex.find(s))) {
output_size += static_cast<int>(s.size()) + 1;
if (limit_output >= 0 && output_size >= limit_output) {
s.clear();
@@ -696,7 +696,7 @@ bool cmFileCommand::HandleStringsCommand(std::vector<std::string> const& args)
if (maxlen > 0 && s.size() == maxlen) {
// Terminate a string if the maximum length is reached.
- if (s.length() >= minlen && (!have_regex || regex.find(s.c_str()))) {
+ if (s.length() >= minlen && (!have_regex || regex.find(s))) {
output_size += static_cast<int>(s.size()) + 1;
if (limit_output >= 0 && output_size >= limit_output) {
s.clear();
@@ -712,7 +712,7 @@ bool cmFileCommand::HandleStringsCommand(std::vector<std::string> const& args)
// input file or the input size limit. Check if the current string
// matches the requirements.
if ((!limit_count || strings.size() < limit_count) && !s.empty() &&
- s.length() >= minlen && (!have_regex || regex.find(s.c_str()))) {
+ s.length() >= minlen && (!have_regex || regex.find(s))) {
output_size += static_cast<int>(s.size()) + 1;
if (limit_output < 0 || output_size < limit_output) {
strings.push_back(s);
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index 7ac0cdf..598b9b6 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -337,7 +337,7 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args,
return false;
}
this->Configs.push_back(args[i]);
- } else if (!haveVersion && version.find(args[i].c_str())) {
+ } else if (!haveVersion && version.find(args[i])) {
haveVersion = true;
this->Version = args[i];
} else {
diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx
index 1594904..3381e6d 100644
--- a/Source/cmGeneratorExpressionNode.cxx
+++ b/Source/cmGeneratorExpressionNode.cxx
@@ -1126,7 +1126,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
std::string targetName = parameters.front();
propertyName = parameters[1];
if (!cmGeneratorExpression::IsValidTargetName(targetName)) {
- if (!propertyNameValidator.find(propertyName.c_str())) {
+ if (!propertyNameValidator.find(propertyName)) {
::reportError(context, content->GetOriginalExpression(),
"Target name and property name not supported.");
return std::string();
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 098c13a..c20fd13 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -1139,7 +1139,7 @@ void cmGeneratorTarget::ComputeKindedSources(KindedSources& files,
std::string cppFileName = xaml + ".cpp";
files.ExpectedXamlHeaders.insert(hFileName);
files.ExpectedXamlSources.insert(cppFileName);
- } else if (header_regex.find(sf->GetFullPath().c_str())) {
+ } else if (header_regex.find(sf->GetFullPath())) {
kind = SourceKindHeader;
} else {
kind = SourceKindExtra;
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index a669477..31f1897 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1971,7 +1971,7 @@ void cmLocalGenerator::AppendCompileOptions(
cmsys::RegularExpression r(regex);
for (std::string const& opt : options_vec) {
- if (r.find(opt.c_str())) {
+ if (r.find(opt)) {
this->AppendFlagEscape(options, opt);
}
}
diff --git a/Source/cmOutputRequiredFilesCommand.cxx b/Source/cmOutputRequiredFilesCommand.cxx
index bdb98ca..e2de3f9 100644
--- a/Source/cmOutputRequiredFilesCommand.cxx
+++ b/Source/cmOutputRequiredFilesCommand.cxx
@@ -356,8 +356,7 @@ protected:
if (!found) {
// Couldn't find any dependency information.
- if (this->ComplainFileRegularExpression.find(
- info->IncludeName.c_str())) {
+ if (this->ComplainFileRegularExpression.find(info->IncludeName)) {
cmSystemTools::Error("error cannot find dependencies for ", path);
} else {
// Destroy the name of the file so that it won't be output as a
diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx
index ed88a1e..1605fd7 100644
--- a/Source/cmStringCommand.cxx
+++ b/Source/cmStringCommand.cxx
@@ -273,7 +273,7 @@ bool cmStringCommand::RegexMatch(std::vector<std::string> const& args)
// Scan through the input for all matches.
std::string output;
- if (re.find(input.c_str())) {
+ if (re.find(input)) {
this->Makefile->StoreMatches(re);
std::string::size_type l = re.start();
std::string::size_type r = re.end();
diff --git a/Source/cmUseMangledMesaCommand.cxx b/Source/cmUseMangledMesaCommand.cxx
index ea012f6..01ef5cb 100644
--- a/Source/cmUseMangledMesaCommand.cxx
+++ b/Source/cmUseMangledMesaCommand.cxx
@@ -82,12 +82,12 @@ void cmUseMangledMesaCommand::CopyAndFullPathMesaHeader(const char* source,
// regular expression for gl GL or xmesa in a file (match(1) of above)
cmsys::RegularExpression glLine("(gl|GL|xmesa)");
while (cmSystemTools::GetLineFromStream(fin, inLine)) {
- if (includeLine.find(inLine.c_str())) {
+ if (includeLine.find(inLine)) {
std::string includeFile = includeLine.match(1);
- if (glDirLine.find(includeFile.c_str())) {
+ if (glDirLine.find(includeFile)) {
std::string gfile = glDirLine.match(3);
fout << "#include \"" << outdir << "/" << gfile << "\"\n";
- } else if (glLine.find(includeFile.c_str())) {
+ } else if (glLine.find(includeFile)) {
fout << "#include \"" << outdir << "/" << includeLine.match(1)
<< "\"\n";
} else {
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 6edaa74..5bb1f22 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -407,7 +407,7 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
for (std::string const& ck : cacheKeys) {
cmStateEnums::CacheEntryType t = this->State->GetCacheEntryType(ck);
if (t != cmStateEnums::STATIC) {
- if (regex.find(ck.c_str())) {
+ if (regex.find(ck)) {
entriesToDelete.push_back(ck);
}
}