diff options
author | Oliver Reiche <oliver.reiche@huawei.com> | 2022-08-25 11:49:14 +0200 |
---|---|---|
committer | Oliver Reiche <oliver.reiche@huawei.com> | 2022-09-13 10:51:13 +0200 |
commit | 6624f964ca0b71d53b81a5481999d2414c977e5d (patch) | |
tree | 2b151e3d75cf5daa1d05e2a2f30bfd327f9bd17a | |
parent | 6008d27431c5ec7dae9107841f702e6e764cdfbb (diff) | |
download | justbuild-6624f964ca0b71d53b81a5481999d2414c977e5d.tar.gz |
Executor: Avoid use of dynamic memory
-rw-r--r-- | src/buildtool/execution_engine/executor/executor.hpp | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/buildtool/execution_engine/executor/executor.hpp b/src/buildtool/execution_engine/executor/executor.hpp index 70dc7d2b..60f131b0 100644 --- a/src/buildtool/execution_engine/executor/executor.hpp +++ b/src/buildtool/execution_engine/executor/executor.hpp @@ -189,13 +189,13 @@ class ExecutorImpl { // NOLINTNEXTLINE(misc-no-recursion) [[nodiscard]] static auto VerifyOrUploadTree( gsl::not_null<IExecutionApi*> const& api, - gsl::not_null<GitTreePtr> const& tree) noexcept -> bool { + GitTree const& tree) noexcept -> bool { // create list of digests for batch check of CAS availability std::vector<ArtifactDigest> digests; std::unordered_map<ArtifactDigest, gsl::not_null<GitTreeEntryPtr>> entry_map; - for (auto const& [path, entry] : *tree) { + for (auto const& [path, entry] : tree) { auto digest = ArtifactDigest{entry->Hash(), *entry->Size(), entry->IsTree()}; digests.emplace_back(digest); @@ -209,7 +209,7 @@ class ExecutorImpl { Logger::Log(LogLevel::Trace, [&tree]() { std::ostringstream oss{}; oss << "upload directory content" << std::endl; - for (auto const& [path, entry] : *tree) { + for (auto const& [path, entry] : tree) { oss << fmt::format(" - {}: {}", path, entry->Hash()) << std::endl; } @@ -224,9 +224,7 @@ class ExecutorImpl { if (auto it = entry_map.find(digest); it != entry_map.end()) { auto const& entry = it->second; if (entry->IsTree()) { - if (not VerifyOrUploadTree( - api, - std::make_shared<GitTree const>(*entry->Tree()))) { + if (not VerifyOrUploadTree(api, *entry->Tree())) { return false; } } @@ -276,8 +274,7 @@ class ExecutorImpl { if (not tree) { return false; } - if (not VerifyOrUploadTree( - api, std::make_shared<GitTree const>(*tree))) { + if (not VerifyOrUploadTree(api, *tree)) { return false; } content = tree->RawData(); |