Pass more values by reference

Rather than copying them around everywhere

Co-authored-by: Eelco Dolstra <edolstra@gmail.com>
This commit is contained in:
Théophane Hufschmitt 2021-06-21 16:37:45 +02:00 committed by regnat
parent dcabb46124
commit c13d7d0b97
3 changed files with 6 additions and 6 deletions

View File

@ -255,8 +255,8 @@ StorePaths Store::topoSortPaths(const StorePathSet & paths)
} }
std::map<DrvOutput, StorePath> drvOutputReferences( std::map<DrvOutput, StorePath> drvOutputReferences(
const std::set<Realisation> inputRealisations, const std::set<Realisation> & inputRealisations,
const StorePathSet pathReferences) const StorePathSet & pathReferences)
{ {
std::map<DrvOutput, StorePath> res; std::map<DrvOutput, StorePath> res;

View File

@ -22,14 +22,14 @@ std::string DrvOutput::to_string() const {
return strHash() + "!" + outputName; return strHash() + "!" + outputName;
} }
std::set<Realisation> Realisation::closure(Store & store, std::set<Realisation> startOutputs) std::set<Realisation> Realisation::closure(Store & store, const std::set<Realisation> & startOutputs)
{ {
std::set<Realisation> res; std::set<Realisation> res;
Realisation::closure(store, startOutputs, res); Realisation::closure(store, startOutputs, res);
return res; return res;
} }
void Realisation::closure(Store & store, std::set<Realisation> startOutputs, std::set<Realisation> & res) void Realisation::closure(Store & store, const std::set<Realisation> & startOutputs, std::set<Realisation> & res)
{ {
auto getDeps = [&](const Realisation& current) -> std::set<Realisation> { auto getDeps = [&](const Realisation& current) -> std::set<Realisation> {
std::set<Realisation> res; std::set<Realisation> res;

View File

@ -44,8 +44,8 @@ struct Realisation {
bool checkSignature(const PublicKeys & publicKeys, const std::string & sig) const; bool checkSignature(const PublicKeys & publicKeys, const std::string & sig) const;
size_t checkSignatures(const PublicKeys & publicKeys) const; size_t checkSignatures(const PublicKeys & publicKeys) const;
static std::set<Realisation> closure(Store &, std::set<Realisation>); static std::set<Realisation> closure(Store &, const std::set<Realisation> &);
static void closure(Store &, std::set<Realisation>, std::set<Realisation>& res); static void closure(Store &, const std::set<Realisation> &, std::set<Realisation>& res);
StorePath getPath() const { return outPath; } StorePath getPath() const { return outPath; }