From abe52429a36e209b7fdd97c3ae87e43b07081aa8 Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Wed, 1 Apr 2015 07:56:14 -0700 Subject: [PATCH] Cleanup: Don't modify during cycle checking. --- src/build.cc | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/build.cc b/src/build.cc index d898929..574aecc 100644 --- a/src/build.cc +++ b/src/build.cc @@ -322,17 +322,13 @@ bool Plan::CheckDependencyCycle(Node* node, vector* stack, string* err) { if (ri == stack->rend()) return false; - // Add this node onto the stack to make it clearer where the loop - // is. - stack->push_back(node); - vector::iterator start = find(stack->begin(), stack->end(), node); *err = "dependency cycle: "; for (vector::iterator i = start; i != stack->end(); ++i) { - if (i != start) - err->append(" -> "); err->append((*i)->path()); + err->append(" -> "); } + err->append(node->path()); return true; } -- 2.7.4