From dc1db0e8b43f5e907a3ded2e39da8b58fa50a04b Mon Sep 17 00:00:00 2001 From: Maksim Denisov Date: Wed, 18 Sep 2024 17:51:41 +0200 Subject: Store HashFunction by const reference. Despite the fact that HashFunction is a small type, it still makes sense to store it by reference to reflect the ownership. StorageConfig becomes the main holder. Reference holders store HashFunction by const ref and aren't allowed to change it. However, they are free to return HashFunction by value since this doesn't benefit readability anyhow. --- src/buildtool/execution_api/common/api_bundle.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/buildtool/execution_api/common/api_bundle.cpp') diff --git a/src/buildtool/execution_api/common/api_bundle.cpp b/src/buildtool/execution_api/common/api_bundle.cpp index 8808e5d8..2106f555 100644 --- a/src/buildtool/execution_api/common/api_bundle.cpp +++ b/src/buildtool/execution_api/common/api_bundle.cpp @@ -24,7 +24,7 @@ auto ApiBundle::Create( gsl::not_null const& local_context, gsl::not_null const& remote_context, RepositoryConfig const* repo_config) -> ApiBundle { - auto const hash_fct = local_context->storage_config->hash_function; + auto const& hash_fct = local_context->storage_config->hash_function; IExecutionApi::Ptr local_api = std::make_shared(local_context, repo_config); IExecutionApi::Ptr remote_api = local_api; @@ -37,7 +37,7 @@ auto ApiBundle::Create( remote_context->auth, remote_context->retry_config, config, - hash_fct); + &hash_fct); } return ApiBundle{.hash_function = hash_fct, .local = std::move(local_api), @@ -58,7 +58,7 @@ auto ApiBundle::MakeRemote( authentication, retry_config, config, - hash_function); + &hash_function); } return local; } -- cgit v1.2.3