diff options
author | Maksim Denisov <denisov.maksim@huawei.com> | 2024-09-18 17:51:41 +0200 |
---|---|---|
committer | Maksim Denisov <denisov.maksim@huawei.com> | 2024-09-23 10:54:50 +0200 |
commit | dc1db0e8b43f5e907a3ded2e39da8b58fa50a04b (patch) | |
tree | 7ca1dd20806fd71c42f875adc1c653df45b147b1 /src/buildtool/execution_api/common/api_bundle.cpp | |
parent | 6453a846e788887b6cd74d71c1873a5e3270434d (diff) | |
download | justbuild-dc1db0e8b43f5e907a3ded2e39da8b58fa50a04b.tar.gz |
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.
Diffstat (limited to 'src/buildtool/execution_api/common/api_bundle.cpp')
-rw-r--r-- | src/buildtool/execution_api/common/api_bundle.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
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<LocalContext const*> const& local_context, gsl::not_null<RemoteContext const*> 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<LocalApi>(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; } |