From 91c449a64a6924afd2aee4d3eb0b80c8c7d9ad07 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 2 Aug 2023 14:40:55 -0600 Subject: [PATCH] [graph] Make space_for non-recursive It was tail-recursive so perhaps the compiler did the same. Anyway, make it explicit now. --- src/graph/graph.hh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/graph/graph.hh b/src/graph/graph.hh index 5062a024b..068095819 100644 --- a/src/graph/graph.hh +++ b/src/graph/graph.hh @@ -1219,6 +1219,7 @@ struct graph_t unsigned space_for (unsigned index, unsigned* root = nullptr) const { + loop: assert (index < vertices_.length); const auto& node = vertices_[index]; if (node.space) @@ -1235,7 +1236,8 @@ struct graph_t return 0; } - return space_for (*node.parents_iter (), root); + index = *node.parents_iter (); + goto loop; } void err_other_error () { this->successful = false; }