aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/misc.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstore/misc.cc')
-rw-r--r--src/libstore/misc.cc9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/libstore/misc.cc b/src/libstore/misc.cc
index dddf13430..05b93d4c9 100644
--- a/src/libstore/misc.cc
+++ b/src/libstore/misc.cc
@@ -29,8 +29,7 @@ void Store::computeFSClosure(const PathSet & startPaths,
{
auto state(state_.lock());
if (state->exc) return;
- if (state->paths.count(path)) return;
- state->paths.insert(path);
+ if (!state->paths.insert(path).second) return;
state->pending++;
}
@@ -175,8 +174,7 @@ void Store::queryMissing(const PathSet & targets,
{
auto state(state_.lock());
- if (state->done.count(path)) return;
- state->done.insert(path);
+ if (!state->done.insert(path).second) return;
}
DrvPathWithOutputs i2 = parseDrvPathWithOutputs(path);
@@ -252,8 +250,7 @@ Paths Store::topoSortPaths(const PathSet & paths)
if (parents.find(path) != parents.end())
throw BuildError(format("cycle detected in the references of '%1%' from '%2%'") % path % *parent);
- if (visited.find(path) != visited.end()) return;
- visited.insert(path);
+ if (!visited.insert(path).second) return;
parents.insert(path);
PathSet references;