diff options
author | Pavel Solodovnikov <hellyeahdominate@gmail.com> | 2018-01-31 15:20:02 (GMT) |
---|---|---|
committer | Pavel Solodovnikov <hellyeahdominate@gmail.com> | 2018-01-31 15:23:03 (GMT) |
commit | 653b894683abe63233cb8679b34ea39d9017e317 (patch) | |
tree | 200e5066b754d8ddfdc7beb86c4db179aa2e69d0 /Source/cmExtraKateGenerator.cxx | |
parent | 4499cc8bb65e217e1cb2959452ed391af82e757b (diff) | |
download | CMake-653b894683abe63233cb8679b34ea39d9017e317.zip CMake-653b894683abe63233cb8679b34ea39d9017e317.tar.gz CMake-653b894683abe63233cb8679b34ea39d9017e317.tar.bz2 |
Reduce raw string pointers usage.
* Change some functions to take `std::string` instead of
`const char*` in the following classes: `cmMakeFile`, `cmake`,
`cmCoreTryCompile`, `cmSystemTools`, `cmState`, `cmLocalGenerator`
and a few others.
* Greatly reduce using of `const char*` overloads for
`cmSystemTools::MakeDirectory` and `cmSystemTools::RelativePath`.
* Remove many redundant `c_str()` conversions throughout the code.
Diffstat (limited to 'Source/cmExtraKateGenerator.cxx')
-rw-r--r-- | Source/cmExtraKateGenerator.cxx | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/Source/cmExtraKateGenerator.cxx b/Source/cmExtraKateGenerator.cxx index 79cc6ef..7a83e41 100644 --- a/Source/cmExtraKateGenerator.cxx +++ b/Source/cmExtraKateGenerator.cxx @@ -81,12 +81,12 @@ void cmExtraKateGenerator::WriteTargets(const cmLocalGenerator* lg, const std::string make = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM"); const std::string makeArgs = mf->GetSafeDefinition("CMAKE_KATE_MAKE_ARGUMENTS"); - const char* homeOutputDir = lg->GetBinaryDirectory(); + std::string const& homeOutputDir = lg->GetBinaryDirectory(); /* clang-format off */ fout << "\t\"build\": {\n" - "\t\t\"directory\": \"" << lg->GetBinaryDirectory() << "\",\n" + "\t\t\"directory\": \"" << homeOutputDir << "\",\n" "\t\t\"default_target\": \"all\",\n" "\t\t\"clean_target\": \"clean\",\n"; /* clang-format on */ @@ -195,13 +195,13 @@ void cmExtraKateGenerator::AppendTarget(cmGeneratedFileStream& fout, const std::string& make, const std::string& makeArgs, const std::string& path, - const char* homeOutputDir) const + const std::string& homeOutputDir) const { static char JsonSep = ' '; fout << "\t\t\t" << JsonSep << "{\"name\":\"" << target << "\", " "\"build_cmd\":\"" - << make << " -C \\\"" << (this->UseNinja ? homeOutputDir : path.c_str()) + << make << " -C \\\"" << (this->UseNinja ? homeOutputDir : path) << "\\\" " << makeArgs << " " << target << "\"}\n"; JsonSep = ','; @@ -228,14 +228,14 @@ std::string cmExtraKateGenerator::GenerateFilesString( { std::string s = lg->GetSourceDirectory(); s += "/.git"; - if (cmSystemTools::FileExists(s.c_str())) { - return std::string("\"git\": 1 "); + if (cmSystemTools::FileExists(s)) { + return "\"git\": 1 "; } s = lg->GetSourceDirectory(); s += "/.svn"; - if (cmSystemTools::FileExists(s.c_str())) { - return std::string("\"svn\": 1 "); + if (cmSystemTools::FileExists(s)) { + return "\"svn\": 1 "; } s = lg->GetSourceDirectory(); |