diff options
author | Vitaly Stakhovsky <vvs31415@gitlab.org> | 2020-03-10 12:13:45 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2020-03-10 18:25:36 (GMT) |
commit | db17de24385283b8c29493b87a280f65157345d9 (patch) | |
tree | 73cb79e7a79a26b5e7c8da5c0abf8be867d1d775 /Source | |
parent | efa30023b4056a4c17e80d7a86bc2506660c68a7 (diff) | |
download | CMake-db17de24385283b8c29493b87a280f65157345d9.zip CMake-db17de24385283b8c29493b87a280f65157345d9.tar.gz CMake-db17de24385283b8c29493b87a280f65157345d9.tar.bz2 |
GHS: Use cm::erase in place of loop
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmGlobalGhsMultiGenerator.cxx | 16 | ||||
-rw-r--r-- | Source/cmGlobalGhsMultiGenerator.h | 2 |
2 files changed, 7 insertions, 11 deletions
diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx index bb9dd37..78e3b43 100644 --- a/Source/cmGlobalGhsMultiGenerator.cxx +++ b/Source/cmGlobalGhsMultiGenerator.cxx @@ -9,6 +9,7 @@ #include <utility> #include <cm/memory> +#include <cm/string> #include "cmAlgorithms.h" #include "cmDocumentationEntry.h" @@ -651,21 +652,16 @@ void cmGlobalGhsMultiGenerator::WriteHighLevelDirectives( char const* const customization = this->GetCMakeInstance()->GetCacheDefinition("GHS_CUSTOMIZATION"); if (nullptr != customization && strlen(customization) > 0) { - fout << "customization=" << this->TrimQuotes(customization) << std::endl; + fout << "customization=" + << cmGlobalGhsMultiGenerator::TrimQuotes(customization) << std::endl; this->GetCMakeInstance()->MarkCliAsUsed("GHS_CUSTOMIZATION"); } } -std::string cmGlobalGhsMultiGenerator::TrimQuotes(std::string const& str) +std::string cmGlobalGhsMultiGenerator::TrimQuotes(std::string str) { - std::string result; - result.reserve(str.size()); - for (const char* ch = str.c_str(); *ch != '\0'; ++ch) { - if (*ch != '"') { - result += *ch; - } - } - return result; + cm::erase(str, '"'); + return str; } bool cmGlobalGhsMultiGenerator::TargetCompare::operator()( diff --git a/Source/cmGlobalGhsMultiGenerator.h b/Source/cmGlobalGhsMultiGenerator.h index b82e9f5..12ca8b6 100644 --- a/Source/cmGlobalGhsMultiGenerator.h +++ b/Source/cmGlobalGhsMultiGenerator.h @@ -111,7 +111,7 @@ private: std::vector<cmLocalGenerator*>& generators, std::string& all_target); - std::string TrimQuotes(std::string const& str); + static std::string TrimQuotes(std::string str); std::string OsDir; static const char* DEFAULT_BUILD_PROGRAM; |