From afbeaa94f798f89e36b08fc33937c42fd09eb113 Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Fri, 30 Jan 2015 22:04:16 +0000 Subject: Have pity on the poor stack. Replace tail recursion by iteration when walking the syntax trees. No functional change. --- usr.bin/mandoc/mdoc_term.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'usr.bin/mandoc/mdoc_term.c') diff --git a/usr.bin/mandoc/mdoc_term.c b/usr.bin/mandoc/mdoc_term.c index 7778ccd9a3f..3e8942f2480 100644 --- a/usr.bin/mandoc/mdoc_term.c +++ b/usr.bin/mandoc/mdoc_term.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mdoc_term.c,v 1.202 2015/01/23 14:19:52 schwarze Exp $ */ +/* $OpenBSD: mdoc_term.c,v 1.203 2015/01/30 22:04:15 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2010, 2012-2015 Ingo Schwarze @@ -289,9 +289,10 @@ static void print_mdoc_nodelist(DECL_ARGS) { - print_mdoc_node(p, pair, meta, n); - if (n->next) - print_mdoc_nodelist(p, pair, meta, n->next); + while (n != NULL) { + print_mdoc_node(p, pair, meta, n); + n = n->next; + } } static void -- cgit v1.2.3