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/cmExtraCodeBlocksGenerator.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/cmExtraCodeBlocksGenerator.cxx')
-rw-r--r-- | Source/cmExtraCodeBlocksGenerator.cxx | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index e4bec7f..4b95140 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -5,7 +5,6 @@ #include <map> #include <ostream> #include <set> -#include <string.h> #include <utility> #include "cmAlgorithms.h" @@ -225,7 +224,7 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile( } const std::string& relative = cmSystemTools::RelativePath( - it.second[0]->GetSourceDirectory(), listFile.c_str()); + it.second[0]->GetSourceDirectory(), listFile); std::vector<std::string> splitted; cmSystemTools::SplitPath(relative, splitted, false); // Split filename from path @@ -296,8 +295,7 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile( case cmStateEnums::GLOBAL_TARGET: { // Only add the global targets from CMAKE_BINARY_DIR, // not from the subdirs - if (strcmp(lg->GetCurrentBinaryDirectory(), - lg->GetBinaryDirectory()) == 0) { + if (lg->GetCurrentBinaryDirectory() == lg->GetBinaryDirectory()) { this->AppendTarget(xml, targetName, nullptr, make.c_str(), lg, compiler.c_str(), makeArgs); } @@ -382,12 +380,12 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile( std::string const& fullPath = s->GetFullPath(); // Check file position relative to project root dir. - const std::string& relative = cmSystemTools::RelativePath( - (*lg).GetSourceDirectory(), fullPath.c_str()); + const std::string& relative = + cmSystemTools::RelativePath(lg->GetSourceDirectory(), fullPath); // Do not add this file if it has ".." in relative path and // if CMAKE_CODEBLOCKS_EXCLUDE_EXTERNAL_FILES variable is on. const bool excludeExternal = - cmSystemTools::IsOn((*lg).GetMakefile()->GetSafeDefinition( + cmSystemTools::IsOn(lg->GetMakefile()->GetSafeDefinition( "CMAKE_CODEBLOCKS_EXCLUDE_EXTERNAL_FILES")); if (excludeExternal && (relative.find("..") != std::string::npos)) { @@ -433,7 +431,7 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile( break; } - if (cmSystemTools::FileExists(hname.c_str())) { + if (cmSystemTools::FileExists(hname)) { allFiles[hname].Targets = allFiles[fileName].Targets; break; } |