about summary refs log tree commit diff
path: root/src/libstore/build.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2017-01-19T14·15+0100
committerEelco Dolstra <edolstra@gmail.com>2017-01-19T16·06+0100
commit2579e32c2bf47a483b823fdf12f0ff66ecaf1b95 (patch)
treed4f35b9713e6595b3c7d7d17319d6e622a2ba4ee /src/libstore/build.cc
parent90ee1e3fe3b3f0cba8dd31ae161eac79ba249291 (diff)
Use std::unique_ptr for HookInstance
Diffstat (limited to 'src/libstore/build.cc')
-rw-r--r--src/libstore/build.cc9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/libstore/build.cc b/src/libstore/build.cc
index ca56d3ad92..e8fb43896b 100644
--- a/src/libstore/build.cc
+++ b/src/libstore/build.cc
@@ -257,7 +257,7 @@ public:
 
     LocalStore & store;
 
-    std::shared_ptr<HookInstance> hook;
+    std::unique_ptr<HookInstance> hook;
 
     Worker(LocalStore & store);
     ~Worker();
@@ -751,7 +751,7 @@ private:
     Pipe userNamespaceSync;
 
     /* The build hook. */
-    std::shared_ptr<HookInstance> hook;
+    std::unique_ptr<HookInstance> hook;
 
     /* Whether we're currently doing a chroot build. */
     bool useChroot = false;
@@ -1566,7 +1566,7 @@ HookReply DerivationGoal::tryBuildHook()
     if (!settings.useBuildHook || getEnv("NIX_BUILD_HOOK") == "" || !useDerivation) return rpDecline;
 
     if (!worker.hook)
-        worker.hook = std::make_shared<HookInstance>();
+        worker.hook = std::make_unique<HookInstance>();
 
     /* Tell the hook about system features (beyond the system type)
        required from the build machine.  (The hook could parse the
@@ -1601,8 +1601,7 @@ HookReply DerivationGoal::tryBuildHook()
 
     printMsg(lvlTalkative, format("using hook to build path(s) %1%") % showPaths(missingPaths));
 
-    hook = worker.hook;
-    worker.hook.reset();
+    hook = std::move(worker.hook);
 
     /* Tell the hook all the inputs that have to be copied to the
        remote system.  This unfortunately has to contain the entire