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/utils/subobject.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/buildtool/execution_api/utils/subobject.cpp') diff --git a/src/buildtool/execution_api/utils/subobject.cpp b/src/buildtool/execution_api/utils/subobject.cpp index 0029a9f3..912e2d4f 100644 --- a/src/buildtool/execution_api/utils/subobject.cpp +++ b/src/buildtool/execution_api/utils/subobject.cpp @@ -15,6 +15,8 @@ #include "src/buildtool/execution_api/utils/subobject.hpp" #ifndef BOOTSTRAP_BUILD_TOOL +#include + #include "src/buildtool/common/protocol_traits.hpp" #include "src/buildtool/crypto/hash_function.hpp" #include "src/buildtool/execution_api/bazel_msg/bazel_msg_factory.hpp" @@ -56,9 +58,11 @@ auto RetrieveSubPathId(Artifact::ObjectInfo object_info, std::optional new_object_info{}; if (not TreeReaderUtils::ReadObjectInfos( *directory, - [&new_object_info, &segment](auto path, auto info) { + [&new_object_info, &segment]( + std::filesystem::path const& path, + Artifact::ObjectInfo&& info) { if (path == segment) { - new_object_info = info; + new_object_info = std::move(info); } return true; })) { @@ -95,9 +99,11 @@ auto RetrieveSubPathId(Artifact::ObjectInfo object_info, std::optional new_object_info{}; if (not TreeReaderUtils::ReadObjectInfos( *entries, - [&new_object_info, &segment](auto path, auto info) { + [&new_object_info, &segment]( + std::filesystem::path const& path, + Artifact::ObjectInfo&& info) { if (path == segment) { - new_object_info = info; + new_object_info = std::move(info); } return true; })) { -- cgit v1.2.3