From 6624f964ca0b71d53b81a5481999d2414c977e5d Mon Sep 17 00:00:00 2001 From: Oliver Reiche Date: Thu, 25 Aug 2022 11:49:14 +0200 Subject: Executor: Avoid use of dynamic memory --- src/buildtool/execution_engine/executor/executor.hpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'src/buildtool/execution_engine/executor/executor.hpp') 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 const& api, - gsl::not_null const& tree) noexcept -> bool { + GitTree const& tree) noexcept -> bool { // create list of digests for batch check of CAS availability std::vector digests; std::unordered_map> 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(*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(*tree))) { + if (not VerifyOrUploadTree(api, *tree)) { return false; } content = tree->RawData(); -- cgit v1.2.3