summaryrefslogtreecommitdiffstats
path: root/src/ninja_jumble.cc
diff options
context:
space:
mode:
authorEvan Martin <martine@danga.com>2011-05-01 02:30:30 (GMT)
committerEvan Martin <martine@danga.com>2011-05-01 02:51:45 (GMT)
commitb95343a7745c7b717d039fc532f857acd5796874 (patch)
tree6ce8a091430dfb6f0f22cc3f2517ff5f0327eb5e /src/ninja_jumble.cc
parenta3aa545229420e8e816ef5983a0983ab590d0ca4 (diff)
downloadNinja-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.cc22
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;
}