about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorGuillaume Maudoux <layus.on@gmail.com>2019-03-09T23·45+0100
committerGuillaume Maudoux <layus.on@gmail.com>2019-03-09T23·56+0100
commit4f4391193cca2f7a28d351947e12f954d9432693 (patch)
treec2c944bc828d8f36f69ab519ee3658b03d610d8c /src
parent38ee16ae9c277b0512559282c950c48c71e27697 (diff)
Fix warning about unused variable
Diffstat (limited to 'src')
-rw-r--r--src/nix-daemon/nix-daemon.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/nix-daemon/nix-daemon.cc b/src/nix-daemon/nix-daemon.cc
index 63b5eb87d9d2..0feafb01385b 100644
--- a/src/nix-daemon/nix-daemon.cc
+++ b/src/nix-daemon/nix-daemon.cc
@@ -477,11 +477,13 @@ static void performOp(TunnelLogger * logger, ref<Store> store,
         logger->startWork();
         Roots roots = store->findRoots();
         logger->stopWork();
+
+        // Pre-compute roots length using same algo as below.
         size_t total_length = 0;
         bool hasMemoryLink;
-        for (auto & [target, links] : roots) {
+        for (auto & root : roots) {
             hasMemoryLink = false;
-            for (auto & link : links) {
+            for (auto & link : root.second) {
                 if (link.rfind("{memory:", 0) == 0) {
                     if (hasMemoryLink) continue;
                     ++total_length;
@@ -491,6 +493,7 @@ static void performOp(TunnelLogger * logger, ref<Store> store,
                 }
             }
         }
+
         to << total_length;
         int n = 0;
         for (auto & [target, links] : roots) {