diff options
author | Sebastian Holtermann <sebholt@xwmw.org> | 2019-03-12 10:39:27 (GMT) |
---|---|---|
committer | Sebastian Holtermann <sebholt@xwmw.org> | 2019-03-12 10:41:56 (GMT) |
commit | e81b4250190fce338711026489f1521fd4cf2acf (patch) | |
tree | 881d64255a6445015756bdcbc30369b8ec0fa6c0 /Source/cmDependsC.cxx | |
parent | d1a54ee26a5a9637b60d094c2b4a7b3251c78b1c (diff) | |
download | CMake-e81b4250190fce338711026489f1521fd4cf2acf.zip CMake-e81b4250190fce338711026489f1521fd4cf2acf.tar.gz CMake-e81b4250190fce338711026489f1521fd4cf2acf.tar.bz2 |
cmDependsC: Remove useless string preallocation artifact
Diffstat (limited to 'Source/cmDependsC.cxx')
-rw-r--r-- | Source/cmDependsC.cxx | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx index f5c106c..cb5039d 100644 --- a/Source/cmDependsC.cxx +++ b/Source/cmDependsC.cxx @@ -123,12 +123,6 @@ bool cmDependsC::WriteDependencies(const std::set<std::string>& sources, } std::set<std::string> scanned; - - // Use reserve to allocate enough memory for tempPathStr - // so that during the loops no memory is allocated or freed - std::string tempPathStr; - tempPathStr.reserve(4 * 1024); - while (!this->Unscanned.empty()) { // Get the next file to scan. UnscannedEntry current = this->Unscanned.front(); @@ -152,17 +146,16 @@ bool cmDependsC::WriteDependencies(const std::set<std::string>& sources, if (headerLocationIt != this->HeaderLocationCache.end()) { fullName = headerLocationIt->second; } else { - for (std::string const& i : this->IncludePath) { + for (std::string const& iPath : this->IncludePath) { // Construct the name of the file as if it were in the current // include directory. Avoid using a leading "./". - - tempPathStr = - cmSystemTools::CollapseCombinedPath(i, current.FileName); + std::string tmpPath = + cmSystemTools::CollapseCombinedPath(iPath, current.FileName); // Look for the file in this location. - if (cmSystemTools::FileExists(tempPathStr, true)) { - fullName = tempPathStr; - HeaderLocationCache[current.FileName] = fullName; + if (cmSystemTools::FileExists(tmpPath, true)) { + fullName = tmpPath; + this->HeaderLocationCache[current.FileName] = std::move(tmpPath); break; } } |