diff options
author | Maksim Denisov <denisov.maksim@huawei.com> | 2024-09-16 11:36:45 +0200 |
---|---|---|
committer | Maksim Denisov <denisov.maksim@huawei.com> | 2024-09-18 16:47:40 +0200 |
commit | bf66b1cc04a0b1e13d53e6c52e44188753b932c4 (patch) | |
tree | 7a192871955a016988caa5276ea2ac1607725b52 /test | |
parent | aa1dc95cbc45ed7dbb1fee8ba11ba7010dfe11af (diff) | |
download | justbuild-bf66b1cc04a0b1e13d53e6c52e44188753b932c4.tar.gz |
Avoid additional memory allocations when working with protobuf's types.
Although this change doesn't benefit performance anyhow (protobuf's mutable_*() methods allocate memory lazily), it is better to let protobuf do this on its own.
Diffstat (limited to 'test')
-rw-r--r-- | test/utils/remote_execution/bazel_action_creator.hpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/test/utils/remote_execution/bazel_action_creator.hpp b/test/utils/remote_execution/bazel_action_creator.hpp index ad9b3fbc..b7185121 100644 --- a/test/utils/remote_execution/bazel_action_creator.hpp +++ b/test/utils/remote_execution/bazel_action_creator.hpp @@ -76,11 +76,9 @@ blobs.emplace_back(dir_id, dir_data, /*is_exec=*/false); bazel_re::Action action; - action.set_allocated_command_digest( - gsl::owner<bazel_re::Digest*>{new bazel_re::Digest{cmd_id}}); + (*action.mutable_command_digest()) = cmd_id; action.set_do_not_cache(false); - action.set_allocated_input_root_digest( - gsl::owner<bazel_re::Digest*>{new bazel_re::Digest{dir_id}}); + (*action.mutable_input_root_digest()) = dir_id; auto action_data = action.SerializeAsString(); auto action_id = BazelDigestFactory::HashDataAs<ObjectType::File>( |