Skip to content

Commit a629ce3

Browse files
committed
Use member initializer list for Derivation*Goal::drv
1 parent ba7bbcd commit a629ce3

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/libstore/build/derivation-building-goal.cc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,15 @@
2727
namespace nix {
2828

2929
DerivationBuildingGoal::DerivationBuildingGoal(
30-
const StorePath & drvPath, const Derivation & drv_, Worker & worker, BuildMode buildMode)
30+
const StorePath & drvPath, const Derivation & drv, Worker & worker, BuildMode buildMode)
3131
: Goal(worker, gaveUpOnSubstitution())
3232
, drvPath(drvPath)
33+
, drv{std::make_unique<Derivation>(drv)}
3334
, buildMode(buildMode)
3435
{
35-
drv = std::make_unique<Derivation>(drv_);
36-
3736
try {
3837
drvOptions =
39-
std::make_unique<DerivationOptions>(DerivationOptions::fromStructuredAttrs(drv->env, drv->structuredAttrs));
38+
std::make_unique<DerivationOptions>(DerivationOptions::fromStructuredAttrs(drv.env, drv.structuredAttrs));
4039
} catch (Error & e) {
4140
e.addTrace({}, "while parsing derivation '%s'", worker.store.printStorePath(drvPath));
4241
throw;

src/libstore/build/derivation-goal.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ DerivationGoal::DerivationGoal(
3333
: Goal(worker, haveDerivation())
3434
, drvPath(drvPath)
3535
, wantedOutput(wantedOutput)
36+
, drv{std::make_unique<Derivation>(drv)}
3637
, outputHash{[&] {
3738
auto outputHashes = staticOutputHashes(worker.evalStore, drv);
3839
if (auto * mOutputHash = get(outputHashes, wantedOutput))
@@ -41,7 +42,6 @@ DerivationGoal::DerivationGoal(
4142
}()}
4243
, buildMode(buildMode)
4344
{
44-
this->drv = std::make_unique<Derivation>(drv);
4545

4646
name = fmt("getting output '%s' from derivation '%s'", wantedOutput, worker.store.printStorePath(drvPath));
4747
trace("created");

0 commit comments

Comments
 (0)