From 3f7519526f7e2cd3ede01c3910fbfe2ddf0f051f Mon Sep 17 00:00:00 2001 From: eldritch horrors Date: Wed, 25 Sep 2024 23:57:46 +0200 Subject: 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 --- src/libstore/build/worker.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/libstore/build/worker.cc') 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, kj::Promise> Worker::makeDerivationGoalCommon( const StorePath & drvPath, const OutputsSpec & wantedOutputs, - std::function()> mkDrvGoal) + std::function()> mkDrvGoal) { auto & goal_weak = derivationGoals[drvPath]; std::shared_ptr goal = goal_weak.goal.lock(); @@ -78,9 +78,9 @@ std::pair, kj::Promise> Worker::makeDeriva return makeDerivationGoalCommon( drvPath, wantedOutputs, - [&]() -> std::shared_ptr { + [&]() -> std::unique_ptr { return !dynamic_cast(&store) - ? std::make_shared( + ? std::make_unique( drvPath, wantedOutputs, *this, running, buildMode ) : LocalDerivationGoal::makeLocalDerivationGoal( @@ -101,9 +101,9 @@ std::pair, kj::Promise> Worker::makeBasicD return makeDerivationGoalCommon( drvPath, wantedOutputs, - [&]() -> std::shared_ptr { + [&]() -> std::unique_ptr { return !dynamic_cast(&store) - ? std::make_shared( + ? std::make_unique( drvPath, drv, wantedOutputs, *this, running, buildMode ) : LocalDerivationGoal::makeLocalDerivationGoal( -- cgit v1.2.3