diff options
author | eldritch horrors <pennae@lix.systems> | 2024-09-25 23:57:46 +0200 |
---|---|---|
committer | eldritch horrors <pennae@lix.systems> | 2024-09-29 12:09:24 +0000 |
commit | 3f7519526f7e2cd3ede01c3910fbfe2ddf0f051f (patch) | |
tree | c477bae7e352bab85849ca85bcbbb52bfd1200e1 /src/libstore/build/worker.cc | |
parent | 289e7a6b5a84c64142a10bdd875f8a06e3987579 (diff) |
libstore: have makeLocalDerivationGoal return unique_ptrs
these can be unique rather than shared because shared_ptr has a
converting constructor. preparatory refactor for something else
and not necessary on its own, and the extra allocations we must
do for shared_ptr control blocks isn't usually relevant anyway.
Change-Id: I5391715545240c6ec8e83a031206edafdfc6462f
Diffstat (limited to 'src/libstore/build/worker.cc')
-rw-r--r-- | src/libstore/build/worker.cc | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/libstore/build/worker.cc b/src/libstore/build/worker.cc index 68071a94c..18cdde63a 100644 --- a/src/libstore/build/worker.cc +++ b/src/libstore/build/worker.cc @@ -55,7 +55,7 @@ Worker::~Worker() std::pair<std::shared_ptr<DerivationGoal>, kj::Promise<void>> Worker::makeDerivationGoalCommon( const StorePath & drvPath, const OutputsSpec & wantedOutputs, - std::function<std::shared_ptr<DerivationGoal>()> mkDrvGoal) + std::function<std::unique_ptr<DerivationGoal>()> mkDrvGoal) { auto & goal_weak = derivationGoals[drvPath]; std::shared_ptr<DerivationGoal> goal = goal_weak.goal.lock(); @@ -78,9 +78,9 @@ std::pair<std::shared_ptr<DerivationGoal>, kj::Promise<void>> Worker::makeDeriva return makeDerivationGoalCommon( drvPath, wantedOutputs, - [&]() -> std::shared_ptr<DerivationGoal> { + [&]() -> std::unique_ptr<DerivationGoal> { return !dynamic_cast<LocalStore *>(&store) - ? std::make_shared<DerivationGoal>( + ? std::make_unique<DerivationGoal>( drvPath, wantedOutputs, *this, running, buildMode ) : LocalDerivationGoal::makeLocalDerivationGoal( @@ -101,9 +101,9 @@ std::pair<std::shared_ptr<DerivationGoal>, kj::Promise<void>> Worker::makeBasicD return makeDerivationGoalCommon( drvPath, wantedOutputs, - [&]() -> std::shared_ptr<DerivationGoal> { + [&]() -> std::unique_ptr<DerivationGoal> { return !dynamic_cast<LocalStore *>(&store) - ? std::make_shared<DerivationGoal>( + ? std::make_unique<DerivationGoal>( drvPath, drv, wantedOutputs, *this, running, buildMode ) : LocalDerivationGoal::makeLocalDerivationGoal( |