mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-02 04:09:33 -05:00
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.
This commit is contained in:
@@ -81,7 +81,7 @@ bool cmExecProgramCommand::InitialPass(std::vector<std::string> const& args,
|
||||
std::string output;
|
||||
bool result = true;
|
||||
if (args.size() - count == 2) {
|
||||
cmSystemTools::MakeDirectory(args[1].c_str());
|
||||
cmSystemTools::MakeDirectory(args[1]);
|
||||
result = cmExecProgramCommand::RunCommand(command.c_str(), output, retVal,
|
||||
args[1].c_str(), verbose);
|
||||
} else {
|
||||
@@ -149,7 +149,7 @@ bool cmExecProgramCommand::RunCommand(const char* command, std::string& output,
|
||||
if (quoted.find(command)) {
|
||||
std::string cmd = quoted.match(1);
|
||||
std::string args = quoted.match(2);
|
||||
if (!cmSystemTools::FileExists(cmd.c_str())) {
|
||||
if (!cmSystemTools::FileExists(cmd)) {
|
||||
shortCmd = cmd;
|
||||
} else if (!cmSystemTools::GetShortPath(cmd.c_str(), shortCmd)) {
|
||||
cmSystemTools::Error("GetShortPath failed for ", cmd.c_str());
|
||||
|
||||
Reference in New Issue
Block a user