diff options
author | Evan Martin <martine@danga.com> | 2011-05-01 02:30:30 (GMT) |
---|---|---|
committer | Evan Martin <martine@danga.com> | 2011-05-01 02:51:45 (GMT) |
commit | b95343a7745c7b717d039fc532f857acd5796874 (patch) | |
tree | 6ce8a091430dfb6f0f22cc3f2517ff5f0327eb5e /src/ninja_jumble.cc | |
parent | a3aa545229420e8e816ef5983a0983ab590d0ca4 (diff) | |
download | Ninja-b95343a7745c7b717d039fc532f857acd5796874.zip Ninja-b95343a7745c7b717d039fc532f857acd5796874.tar.gz Ninja-b95343a7745c7b717d039fc532f857acd5796874.tar.bz2 |
add test for RootNodes(); fix comment
Diffstat (limited to 'src/ninja_jumble.cc')
-rw-r--r-- | src/ninja_jumble.cc | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/ninja_jumble.cc b/src/ninja_jumble.cc index e6a0de6..cb0ca5e 100644 --- a/src/ninja_jumble.cc +++ b/src/ninja_jumble.cc @@ -183,20 +183,20 @@ void State::AddOut(Edge* edge, const string& path) { node->in_edge_ = edge; } -vector<Node*> State::RootNodes(string* error) -{ - assert(error); +vector<Node*> State::RootNodes(string* err) { vector<Node*> root_nodes; // Search for nodes with no output. - for (vector<Edge*>::iterator e = edges_.begin(); e != edges_.end(); ++e) - for (vector<Node*>::iterator outs = (*e)->outputs_.begin(); - outs != (*e)->outputs_.end(); - ++outs) - if ((*outs)->out_edges_.size() == 0) - root_nodes.push_back(*outs); - if (!edges_.empty() && root_nodes.empty()) { - *error = "could not determine root nodes of build graph"; + for (vector<Edge*>::iterator e = edges_.begin(); e != edges_.end(); ++e) { + for (vector<Node*>::iterator out = (*e)->outputs_.begin(); + out != (*e)->outputs_.end(); ++out) { + if ((*out)->out_edges_.empty()) + root_nodes.push_back(*out); + } } + + if (!edges_.empty() && root_nodes.empty()) + *err = "could not determine root nodes of build graph"; + assert(edges_.empty() || !root_nodes.empty()); return root_nodes; } |