From c13d7d0b9770741cc7093dc71ec8fc7978171f18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophane=20Hufschmitt?= Date: Mon, 21 Jun 2021 16:37:45 +0200 Subject: [PATCH] Pass more values by reference Rather than copying them around everywhere Co-authored-by: Eelco Dolstra --- src/libstore/misc.cc | 4 ++-- src/libstore/realisation.cc | 4 ++-- src/libstore/realisation.hh | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/libstore/misc.cc b/src/libstore/misc.cc index 80ee15c49..96d73b70e 100644 --- a/src/libstore/misc.cc +++ b/src/libstore/misc.cc @@ -255,8 +255,8 @@ StorePaths Store::topoSortPaths(const StorePathSet & paths) } std::map drvOutputReferences( - const std::set inputRealisations, - const StorePathSet pathReferences) + const std::set & inputRealisations, + const StorePathSet & pathReferences) { std::map res; diff --git a/src/libstore/realisation.cc b/src/libstore/realisation.cc index d2d306476..0d9d4b433 100644 --- a/src/libstore/realisation.cc +++ b/src/libstore/realisation.cc @@ -22,14 +22,14 @@ std::string DrvOutput::to_string() const { return strHash() + "!" + outputName; } -std::set Realisation::closure(Store & store, std::set startOutputs) +std::set Realisation::closure(Store & store, const std::set & startOutputs) { std::set res; Realisation::closure(store, startOutputs, res); return res; } -void Realisation::closure(Store & store, std::set startOutputs, std::set & res) +void Realisation::closure(Store & store, const std::set & startOutputs, std::set & res) { auto getDeps = [&](const Realisation& current) -> std::set { std::set res; diff --git a/src/libstore/realisation.hh b/src/libstore/realisation.hh index 8cda5a752..7fdb65acd 100644 --- a/src/libstore/realisation.hh +++ b/src/libstore/realisation.hh @@ -44,8 +44,8 @@ struct Realisation { bool checkSignature(const PublicKeys & publicKeys, const std::string & sig) const; size_t checkSignatures(const PublicKeys & publicKeys) const; - static std::set closure(Store &, std::set); - static void closure(Store &, std::set, std::set& res); + static std::set closure(Store &, const std::set &); + static void closure(Store &, const std::set &, std::set& res); StorePath getPath() const { return outPath; }