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/cmDependsC.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/cmDependsC.cxx')
-rw-r--r-- | Source/cmDependsC.cxx | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx index 29755d9..62bc8d9 100644 --- a/Source/cmDependsC.cxx +++ b/Source/cmDependsC.cxx @@ -131,14 +131,12 @@ bool cmDependsC::WriteDependencies(const std::set<std::string>& sources, // If not a full path, find the file in the include path. std::string fullName; - if ((srcFiles > 0) || - cmSystemTools::FileIsFullPath(current.FileName.c_str())) { - if (cmSystemTools::FileExists(current.FileName.c_str(), true)) { + if ((srcFiles > 0) || cmSystemTools::FileIsFullPath(current.FileName)) { + if (cmSystemTools::FileExists(current.FileName, true)) { fullName = current.FileName; } } else if (!current.QuotedLocation.empty() && - cmSystemTools::FileExists(current.QuotedLocation.c_str(), - true)) { + cmSystemTools::FileExists(current.QuotedLocation, true)) { // The include statement producing this entry was a double-quote // include and the included file is present in the directory of // the source containing the include statement. @@ -157,7 +155,7 @@ bool cmDependsC::WriteDependencies(const std::set<std::string>& sources, cmSystemTools::CollapseCombinedPath(i, current.FileName); // Look for the file in this location. - if (cmSystemTools::FileExists(tempPathStr.c_str(), true)) { + if (cmSystemTools::FileExists(tempPathStr, true)) { fullName = tempPathStr; HeaderLocationCache[current.FileName] = fullName; break; @@ -226,15 +224,14 @@ bool cmDependsC::WriteDependencies(const std::set<std::string>& sources, // directory. We must do the same here. std::string binDir = this->LocalGenerator->GetBinaryDirectory(); std::string obj_i = this->LocalGenerator->ConvertToRelativePath(binDir, obj); - std::string obj_m = cmSystemTools::ConvertToOutputPath(obj_i.c_str()); + std::string obj_m = cmSystemTools::ConvertToOutputPath(obj_i); internalDepends << obj_i << std::endl; for (std::string const& dep : dependencies) { - makeDepends - << obj_m << ": " - << cmSystemTools::ConvertToOutputPath( - this->LocalGenerator->ConvertToRelativePath(binDir, dep).c_str()) - << std::endl; + makeDepends << obj_m << ": " + << cmSystemTools::ConvertToOutputPath( + this->LocalGenerator->ConvertToRelativePath(binDir, dep)) + << std::endl; internalDepends << " " << dep << std::endl; } makeDepends << std::endl; @@ -363,7 +360,7 @@ void cmDependsC::Scan(std::istream& is, const char* directory, entry.FileName = this->IncludeRegexLine.match(2); cmSystemTools::ConvertToUnixSlashes(entry.FileName); if (this->IncludeRegexLine.match(3) == "\"" && - !cmSystemTools::FileIsFullPath(entry.FileName.c_str())) { + !cmSystemTools::FileIsFullPath(entry.FileName)) { // This was a double-quoted include with a relative path. We // must check for the file in the directory containing the // file we are scanning. |