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(
const std::set<Realisation> inputRealisations,
const StorePathSet pathReferences)
const std::set<Realisation> & inputRealisations,
const StorePathSet & pathReferences)
{
std::map<DrvOutput, StorePath> res;

View file

@ -22,14 +22,14 @@ std::string DrvOutput::to_string() const {
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;
Realisation::closure(store, startOutputs, 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> {
std::set<Realisation> res;

View file

@ -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<Realisation> closure(Store &, std::set<Realisation>);
static void closure(Store &, std::set<Realisation>, std::set<Realisation>& res);
static std::set<Realisation> closure(Store &, const std::set<Realisation> &);
static void closure(Store &, const std::set<Realisation> &, std::set<Realisation>& res);
StorePath getPath() const { return outPath; }