summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-05-25 13:34:29 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2016-05-25 13:34:29 (GMT)
commit6052e4b3bfe62a8d29ca679affb101c7aec0d219 (patch)
treedb207f809276b9c5691c889b9e658befc93e6d4c /Source/cmLocalGenerator.cxx
parent9ebc2092885fa32eaa47aade965fcec2cfa308d0 (diff)
parent5784747d1b0404a0c1cb0223b15b823476023fba (diff)
downloadCMake-6052e4b3bfe62a8d29ca679affb101c7aec0d219.zip
CMake-6052e4b3bfe62a8d29ca679affb101c7aec0d219.tar.gz
CMake-6052e4b3bfe62a8d29ca679affb101c7aec0d219.tar.bz2
Merge topic 'improve-character-find-and-replace'
5784747d Improve string find: prefer character overloads. 5cec953e Use std::replace for replacing chars in strings. 2a1a2033 cmExtraEclipseCDT4Generator: use std::replace. 34bc6e1f cmCTestScriptHandler: don't call find repeatedly.
Diffstat (limited to 'Source/cmLocalGenerator.cxx')
-rw-r--r--Source/cmLocalGenerator.cxx12
1 files changed, 6 insertions, 6 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index a350f09..2de12ba 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -640,7 +640,7 @@ std::string cmLocalGenerator::ExpandRuleVariable(
if (variable == "TARGET_BASE") {
// Strip the last extension off the target name.
std::string targetBase = replaceValues.Target;
- std::string::size_type pos = targetBase.rfind(".");
+ std::string::size_type pos = targetBase.rfind('.');
if (pos != targetBase.npos) {
return targetBase.substr(0, pos);
} else {
@@ -2306,16 +2306,16 @@ std::string& cmLocalGenerator::CreateSafeUniqueObjectFileName(
std::string ssin = sin;
// Avoid full paths by removing leading slashes.
- ssin.erase(0, ssin.find_first_not_of("/"));
+ ssin.erase(0, ssin.find_first_not_of('/'));
// Avoid full paths by removing colons.
- cmSystemTools::ReplaceString(ssin, ":", "_");
+ std::replace(ssin.begin(), ssin.end(), ':', '_');
// Avoid relative paths that go up the tree.
cmSystemTools::ReplaceString(ssin, "../", "__/");
// Avoid spaces.
- cmSystemTools::ReplaceString(ssin, " ", "_");
+ std::replace(ssin.begin(), ssin.end(), ' ', '_');
// Mangle the name if necessary.
if (this->Makefile->IsOn("CMAKE_MANGLE_OBJECT_FILE_NAMES")) {
@@ -2464,7 +2464,7 @@ std::string cmLocalGenerator::GetObjectFileNameWithoutTarget(
// Remove the source extension if it is to be replaced.
if (replaceExt) {
keptSourceExtension = false;
- std::string::size_type dot_pos = objectName.rfind(".");
+ std::string::size_type dot_pos = objectName.rfind('.');
if (dot_pos != std::string::npos) {
objectName = objectName.substr(0, dot_pos);
}
@@ -2603,7 +2603,7 @@ bool cmLocalGenerator::CheckDefinition(std::string const& define) const
}
// Many compilers do not support # in the value so we disable it.
- if (define.find_first_of("#") != define.npos) {
+ if (define.find_first_of('#') != define.npos) {
std::ostringstream e;
/* clang-format off */
e << "WARNING: Preprocessor definitions containing '#' may not be "