summaryrefslogtreecommitdiff
path: root/Source/cmBuildNameCommand.cxx
diff options
context:
space:
mode:
authorDaniel Pfeifer <daniel@pfeifer-mail.de>2016-05-24 22:58:11 +0200
committerDaniel Pfeifer <daniel@pfeifer-mail.de>2016-05-24 23:22:20 +0200
commit5cec953e6aafd4c132a7b6c0a929d95c1dee79ea (patch)
tree09cf2f4a8f28c5ca8a7e648486fc10e1ae5e2d89 /Source/cmBuildNameCommand.cxx
parent2a1a2033afe73da08af46e12ed77a8f55a89417f (diff)
downloadcmake-5cec953e6aafd4c132a7b6c0a929d95c1dee79ea.tar.gz
Use std::replace for replacing chars in strings.
Find uses of `cmSystemTools::ReplaceString` where both `replace` and `with` are string literals with a size of one. Automate with: git grep -l ReplaceString | xargs sed -i "s|cmSystemTools::ReplaceString(\([^,]*\), \"\(.\)\", \"\(.\)\");|std::replace(\1.begin(), \1.end(), '\2', '\3');|g" git grep -l ReplaceString | xargs sed -i "s|cmSystemTools::ReplaceString(\([^,]*\), \"\(.\)\", \"\\\\\\\\\");|std::replace(\1.begin(), \1.end(), '\2', '\\\\\\\\');|g" git grep -l ReplaceString | xargs sed -i "s|cmSystemTools::ReplaceString(\([^,]*\), \"\\\\\\\\\", \"\(.\)\");|std::replace(\1.begin(), \1.end(), '\\\\\\\\', '\2');|g"
Diffstat (limited to 'Source/cmBuildNameCommand.cxx')
-rw-r--r--Source/cmBuildNameCommand.cxx12
1 files changed, 6 insertions, 6 deletions
diff --git a/Source/cmBuildNameCommand.cxx b/Source/cmBuildNameCommand.cxx
index 7ed96ab4c5..27234d73cf 100644
--- a/Source/cmBuildNameCommand.cxx
+++ b/Source/cmBuildNameCommand.cxx
@@ -32,9 +32,9 @@ bool cmBuildNameCommand::InitialPass(std::vector<std::string> const& args,
cmsys::RegularExpression reg("[()/]");
if (reg.find(cacheValue)) {
std::string cv = cacheValue;
- cmSystemTools::ReplaceString(cv, "/", "_");
- cmSystemTools::ReplaceString(cv, "(", "_");
- cmSystemTools::ReplaceString(cv, ")", "_");
+ std::replace(cv.begin(), cv.end(), '/', '_');
+ std::replace(cv.begin(), cv.end(), '(', '_');
+ std::replace(cv.begin(), cv.end(), ')', '_');
this->Makefile->AddCacheDefinition(args[0], cv.c_str(), "Name of build.",
cmState::STRING);
}
@@ -57,9 +57,9 @@ bool cmBuildNameCommand::InitialPass(std::vector<std::string> const& args,
this->Makefile->ExpandVariablesInString(compiler);
buildname += "-";
buildname += cmSystemTools::GetFilenameName(compiler);
- cmSystemTools::ReplaceString(buildname, "/", "_");
- cmSystemTools::ReplaceString(buildname, "(", "_");
- cmSystemTools::ReplaceString(buildname, ")", "_");
+ std::replace(buildname.begin(), buildname.end(), '/', '_');
+ std::replace(buildname.begin(), buildname.end(), '(', '_');
+ std::replace(buildname.begin(), buildname.end(), ')', '_');
this->Makefile->AddCacheDefinition(args[0], buildname.c_str(),
"Name of build.", cmState::STRING);