diff options
author | Maksim Denisov <denisov.maksim@huawei.com> | 2024-09-16 11:19:11 +0200 |
---|---|---|
committer | Maksim Denisov <denisov.maksim@huawei.com> | 2024-09-18 16:47:40 +0200 |
commit | 10d97aee7d2cdf4c5ea425491786fe9e59360299 (patch) | |
tree | 8a97ea8870815ab542bd636896e6f4819813b85f /src/buildtool/execution_api/utils/subobject.cpp | |
parent | 1d748c1808e17998b4183574e3706ef1f7b6a5db (diff) | |
download | justbuild-10d97aee7d2cdf4c5ea425491786fe9e59360299.tar.gz |
TreeReaderUtils: change InfoStoreFunc interface
...passing constructed Artifact::ObjectInfo by rvalue, to avoid additional copies.
Diffstat (limited to 'src/buildtool/execution_api/utils/subobject.cpp')
-rw-r--r-- | src/buildtool/execution_api/utils/subobject.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
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 <utility> + #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<Artifact::ObjectInfo> 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<Artifact::ObjectInfo> 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; })) { |