diff --git a/Source/cmSearchPath.cxx b/Source/cmSearchPath.cxx index bf3480ffb6..6784ef2f8f 100644 --- a/Source/cmSearchPath.cxx +++ b/Source/cmSearchPath.cxx @@ -25,15 +25,11 @@ cmSearchPath::~cmSearchPath() = default; void cmSearchPath::ExtractWithout(const std::set& ignorePaths, const std::set& ignorePrefixes, - std::vector& outPaths, - bool clear) const + std::vector& outPaths) const { - if (clear) { - outPaths.clear(); - } for (auto const& path : this->Paths) { - if (ignorePaths.count(path.Path) == 0 && - ignorePrefixes.count(path.Prefix) == 0) { + if (ignorePaths.find(path.Path) == ignorePaths.end() && + ignorePrefixes.find(path.Prefix) == ignorePrefixes.end()) { outPaths.push_back(path.Path); } } @@ -144,16 +140,16 @@ void cmSearchPath::AddSuffixes(const std::vector& suffixes) // path on windows and cause huge delays. std::string p = inPath.Path; if (!p.empty() && p.back() != '/') { - p += "/"; + p += '/'; } // Combine with all the suffixes for (std::string const& suffix : suffixes) { - this->Paths.push_back(PathWithPrefix{ p + suffix, inPath.Prefix }); + this->Paths.emplace_back(PathWithPrefix{ p + suffix, inPath.Prefix }); } // And now the original w/o any suffix - this->Paths.push_back(std::move(inPath)); + this->Paths.emplace_back(std::move(inPath)); } } diff --git a/Source/cmSearchPath.h b/Source/cmSearchPath.h index 895f4a3c73..16d11c41eb 100644 --- a/Source/cmSearchPath.h +++ b/Source/cmSearchPath.h @@ -45,8 +45,7 @@ public: void ExtractWithout(const std::set& ignorePaths, const std::set& ignorePrefixes, - std::vector& outPaths, - bool clear = false) const; + std::vector& outPaths) const; void AddPath(const std::string& path); void AddUserPath(const std::string& path);