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/storage/local_cas.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/buildtool/storage/local_cas.hpp') diff --git a/src/buildtool/storage/local_cas.hpp b/src/buildtool/storage/local_cas.hpp index 8a95c234..8c8d70c2 100644 --- a/src/buildtool/storage/local_cas.hpp +++ b/src/buildtool/storage/local_cas.hpp @@ -52,13 +52,13 @@ class LocalCAS { explicit LocalCAS( GenerationConfig const& config, gsl::not_null const*> const& uplinker) - : cas_file_{config.storage_config->hash_function, + : cas_file_{&config.storage_config->hash_function, config.cas_f, MakeUplinker(config, uplinker)}, - cas_exec_{config.storage_config->hash_function, + cas_exec_{&config.storage_config->hash_function, config.cas_x, MakeUplinker(config, uplinker)}, - cas_tree_{config.storage_config->hash_function, + cas_tree_{&config.storage_config->hash_function, config.cas_t, MakeUplinker(config, uplinker)}, cas_file_large_{this, config, uplinker}, @@ -284,7 +284,7 @@ class LocalCAS { ObjectCAS cas_tree_; LargeObjectCAS cas_file_large_; LargeObjectCAS cas_tree_large_; - HashFunction const hash_function_; + HashFunction const& hash_function_; /// \brief Provides uplink via "exists callback" for physical object CAS. template -- cgit v1.2.3