From 4f4391193cca2f7a28d351947e12f954d9432693 Mon Sep 17 00:00:00 2001 From: Guillaume Maudoux Date: Sun, 10 Mar 2019 00:45:55 +0100 Subject: [PATCH] Fix warning about unused variable --- src/nix-daemon/nix-daemon.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/nix-daemon/nix-daemon.cc b/src/nix-daemon/nix-daemon.cc index 63b5eb87d..0feafb013 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, 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, } } } + to << total_length; int n = 0; for (auto & [target, links] : roots) {