From 38ccf2e24168ab5c0d2a7cf6b5bdec1b0784ebcd Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 1 Jul 2020 15:31:34 +0200 Subject: [PATCH] Cleanup --- src/libstore/remote-store.cc | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/libstore/remote-store.cc b/src/libstore/remote-store.cc index dc82dbdd9..8c648d671 100644 --- a/src/libstore/remote-store.cc +++ b/src/libstore/remote-store.cc @@ -42,15 +42,12 @@ std::map readOutputPathMap(const Store & store, Source & from { std::map pathMap; auto rawInput = readStrings(from); + if (rawInput.size() % 2) + throw Error("got an odd number of elements from the daemon when trying to read a output path map"); auto curInput = rawInput.begin(); while (curInput != rawInput.end()) { - string thisKey = *curInput; - curInput = std::next(curInput); - if (curInput == rawInput.end()) { - throw Error("Got an odd number of elements from the daemon when trying to read a map… that's odd"); - } - string thisValue = *curInput; - curInput = std::next(curInput); + auto thisKey = *curInput++; + auto thisValue = *curInput++; pathMap.emplace(thisKey, store.parseStorePath(thisValue)); } return pathMap;