From 10d97aee7d2cdf4c5ea425491786fe9e59360299 Mon Sep 17 00:00:00 2001 From: Maksim Denisov Date: Mon, 16 Sep 2024 11:19:11 +0200 Subject: TreeReaderUtils: change InfoStoreFunc interface ...passing constructed Artifact::ObjectInfo by rvalue, to avoid additional copies. --- src/buildtool/execution_api/common/tree_reader.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/buildtool/execution_api/common/tree_reader.hpp') diff --git a/src/buildtool/execution_api/common/tree_reader.hpp b/src/buildtool/execution_api/common/tree_reader.hpp index de1e2edf..857573df 100644 --- a/src/buildtool/execution_api/common/tree_reader.hpp +++ b/src/buildtool/execution_api/common/tree_reader.hpp @@ -53,9 +53,9 @@ class TreeReader final { TreeReaderUtils::InfoStoreFunc store_info = [&result, &parent](std::filesystem::path const& path, - Artifact::ObjectInfo const& info) { + Artifact::ObjectInfo&& info) { result.paths.emplace_back(parent / path); - result.infos.emplace_back(info); + result.infos.emplace_back(std::move(info)); return true; }; @@ -125,11 +125,11 @@ class TreeReader final { TreeReaderUtils::InfoStoreFunc internal_store = [this, &store, &parent, include_trees]( std::filesystem::path const& path, - Artifact::ObjectInfo const& info) -> bool { + Artifact::ObjectInfo&& info) -> bool { return IsTreeObject(info.type) ? ReadObjectInfosRecursively( store, parent / path, info.digest, include_trees) - : store(parent / path, info); + : store(parent / path, std::move(info)); }; if (not impl_.IsNativeProtocol()) { -- cgit v1.2.3