diff options
Diffstat (limited to 'nix/libstore/misc.cc')
-rw-r--r-- | nix/libstore/misc.cc | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/nix/libstore/misc.cc b/nix/libstore/misc.cc index d4e6d1b4af..bc5dec88bf 100644 --- a/nix/libstore/misc.cc +++ b/nix/libstore/misc.cc @@ -28,15 +28,15 @@ void computeFSClosure(StoreAPI & store, const Path & path, if (includeOutputs) { PathSet derivers = store.queryValidDerivers(path); - foreach (PathSet::iterator, i, derivers) - edges.insert(*i); + for (auto& i : derivers) + edges.insert(i); } if (includeDerivers && isDerivation(path)) { PathSet outputs = store.queryDerivationOutputs(path); - foreach (PathSet::iterator, i, outputs) - if (store.isValidPath(*i) && store.queryDeriver(*i) == path) - edges.insert(*i); + for (auto& i : outputs) + if (store.isValidPath(i) && store.queryDeriver(i) == path) + edges.insert(i); } } else { @@ -44,8 +44,8 @@ void computeFSClosure(StoreAPI & store, const Path & path, if (includeOutputs && isDerivation(path)) { PathSet outputs = store.queryDerivationOutputs(path); - foreach (PathSet::iterator, i, outputs) - if (store.isValidPath(*i)) edges.insert(*i); + for (auto& i : outputs) + if (store.isValidPath(i)) edges.insert(i); } if (includeDerivers) { @@ -54,8 +54,8 @@ void computeFSClosure(StoreAPI & store, const Path & path, } } - foreach (PathSet::iterator, i, edges) - computeFSClosure(store, *i, paths, flipDirection, includeOutputs, includeDerivers); + for (auto& i : edges) + computeFSClosure(store, i, paths, flipDirection, includeOutputs, includeDerivers); } @@ -74,11 +74,11 @@ static void dfsVisit(StoreAPI & store, const PathSet & paths, if (store.isValidPath(path)) store.queryReferences(path, references); - foreach (PathSet::iterator, i, references) + for (auto& i : references) /* Don't traverse into paths that don't exist. That can happen due to substitutes for non-existent paths. */ - if (*i != path && paths.find(*i) != paths.end()) - dfsVisit(store, paths, *i, visited, sorted, parents); + if (i != path && paths.find(i) != paths.end()) + dfsVisit(store, paths, i, visited, sorted, parents); sorted.push_front(path); parents.erase(path); @@ -89,8 +89,8 @@ Paths topoSortPaths(StoreAPI & store, const PathSet & paths) { Paths sorted; PathSet visited, parents; - foreach (PathSet::const_iterator, i, paths) - dfsVisit(store, paths, *i, visited, sorted, parents); + for (const auto& i : paths) + dfsVisit(store, paths, i, visited, sorted, parents); return sorted; } |