From 02ece164bea52b5dddb98a745f71996b326ee0d1 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 10 Sep 2021 10:39:39 +0200 Subject: [PATCH] Make installables const --- src/libcmd/command.hh | 16 ++++++++++------ src/libcmd/installables.cc | 18 ++++++++++++------ 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/src/libcmd/command.hh b/src/libcmd/command.hh index c7af8bb7c..dac146d24 100644 --- a/src/libcmd/command.hh +++ b/src/libcmd/command.hh @@ -225,15 +225,18 @@ static RegisterCommand registerCommand2(std::vector && name) return RegisterCommand(std::move(name), [](){ return make_ref(); }); } -BuiltPaths build(ref evalStore, ref store, Realise mode, - std::vector> installables, BuildMode bMode = bmNormal); +BuiltPaths build( + ref evalStore, + ref store, Realise mode, + const std::vector> & installables, + BuildMode bMode = bmNormal); std::set toStorePaths( ref evalStore, ref store, Realise mode, OperateOn operateOn, - std::vector> installables); + const std::vector> & installables); StorePath toStorePath( ref evalStore, @@ -242,8 +245,9 @@ StorePath toStorePath( OperateOn operateOn, std::shared_ptr installable); -std::set toDerivations(ref store, - std::vector> installables, +std::set toDerivations( + ref store, + const std::vector> & installables, bool useDeriver = false); BuiltPaths toBuiltPaths( @@ -251,7 +255,7 @@ BuiltPaths toBuiltPaths( ref store, Realise mode, OperateOn operateOn, - std::vector> installables); + const std::vector> & installables); /* Helper function to generate args that invoke $EDITOR on filename:lineno. */ diff --git a/src/libcmd/installables.cc b/src/libcmd/installables.cc index 86080f53a..8015cff4d 100644 --- a/src/libcmd/installables.cc +++ b/src/libcmd/installables.cc @@ -743,8 +743,12 @@ BuiltPaths getBuiltPaths(ref evalStore, ref store, const DerivedPa return res; } -BuiltPaths build(ref evalStore, ref store, Realise mode, - std::vector> installables, BuildMode bMode) +BuiltPaths build( + ref evalStore, + ref store, + Realise mode, + const std::vector> & installables, + BuildMode bMode) { if (mode == Realise::Nothing) settings.readOnlyMode = true; @@ -769,7 +773,7 @@ BuiltPaths toBuiltPaths( ref store, Realise mode, OperateOn operateOn, - std::vector> installables) + const std::vector> & installables) { if (operateOn == OperateOn::Output) return build(evalStore, store, mode, installables); @@ -788,7 +792,7 @@ StorePathSet toStorePaths( ref evalStore, ref store, Realise mode, OperateOn operateOn, - std::vector> installables) + const std::vector> & installables) { StorePathSet outPaths; for (auto & path : toBuiltPaths(evalStore, store, mode, operateOn, installables)) { @@ -812,8 +816,10 @@ StorePath toStorePath( return *paths.begin(); } -StorePathSet toDerivations(ref store, - std::vector> installables, bool useDeriver) +StorePathSet toDerivations( + ref store, + const std::vector> & installables, + bool useDeriver) { StorePathSet drvPaths;