Skip to content

Commit 2162b24

Browse files
committed
channge the depth to positive only. Default is Maximum of int.
1 parent 7d1769a commit 2162b24

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/graphviz.cc

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,8 @@ void GraphViz::AddTarget(const Node* const node, const int depth) {
8787
}
8888
}
8989

90-
if (depth != 0) {
91-
for (const auto in: edge->inputs_) {
92-
AddTarget(in, depth < 0 ? -1 : depth - 1);
93-
}
90+
for (const auto in : edge->inputs_) {
91+
AddTarget(in, depth - 1);
9492
}
9593
}
9694

src/ninja.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <algorithm>
2222
#include <cstdlib>
2323
#include <cstring>
24+
#include <limits>
2425
#include <string>
2526

2627
#ifdef _WIN32
@@ -384,7 +385,7 @@ int NinjaMain::ToolGraph(const Options* options, int argc, char* argv[]) {
384385
argc++;
385386
argv--;
386387

387-
int depth = -1;
388+
int depth = std::numeric_limits<int>::max();
388389

389390
optind = 1;
390391
int opt;

0 commit comments

Comments
 (0)