summaryrefslogtreecommitdiff
path: root/usr.bin/mandoc
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2015-01-30 22:04:16 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2015-01-30 22:04:16 +0000
commitafbeaa94f798f89e36b08fc33937c42fd09eb113 (patch)
tree5062d5230c0e8184cb49442e7e219ee80305e747 /usr.bin/mandoc
parent6d56af274a91080979d1e7bfe78d5b95f6ae0e28 (diff)
Have pity on the poor stack.
Replace tail recursion by iteration when walking the syntax trees. No functional change.
Diffstat (limited to 'usr.bin/mandoc')
-rw-r--r--usr.bin/mandoc/man_html.c11
-rw-r--r--usr.bin/mandoc/man_term.c12
-rw-r--r--usr.bin/mandoc/mdoc_html.c9
-rw-r--r--usr.bin/mandoc/mdoc_term.c9
4 files changed, 22 insertions, 19 deletions
diff --git a/usr.bin/mandoc/man_html.c b/usr.bin/mandoc/man_html.c
index df647c50da1..40f1dcbcdf3 100644
--- a/usr.bin/mandoc/man_html.c
+++ b/usr.bin/mandoc/man_html.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: man_html.c,v 1.62 2015/01/24 02:41:32 schwarze Exp $ */
+/* $OpenBSD: man_html.c,v 1.63 2015/01/30 22:04:15 schwarze Exp $ */
/*
* Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
- * Copyright (c) 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
+ * Copyright (c) 2013, 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -190,9 +190,10 @@ static void
print_man_nodelist(MAN_ARGS)
{
- print_man_node(man, n, mh, h);
- if (n->next)
- print_man_nodelist(man, n->next, mh, h);
+ while (n != NULL) {
+ print_man_node(man, n, mh, h);
+ n = n->next;
+ }
}
static void
diff --git a/usr.bin/mandoc/man_term.c b/usr.bin/mandoc/man_term.c
index a66ab89c2dc..58bc565e7da 100644
--- a/usr.bin/mandoc/man_term.c
+++ b/usr.bin/mandoc/man_term.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: man_term.c,v 1.120 2015/01/30 17:31:20 schwarze Exp $ */
+/* $OpenBSD: man_term.c,v 1.121 2015/01/30 22:04:15 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
- * Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.org>
+ * Copyright (c) 2010-2015 Ingo Schwarze <schwarze@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -1005,10 +1005,10 @@ static void
print_man_nodelist(DECL_ARGS)
{
- print_man_node(p, mt, n, meta);
- if ( ! n->next)
- return;
- print_man_nodelist(p, mt, n->next, meta);
+ while (n != NULL) {
+ print_man_node(p, mt, n, meta);
+ n = n->next;
+ }
}
static void
diff --git a/usr.bin/mandoc/mdoc_html.c b/usr.bin/mandoc/mdoc_html.c
index 5c72b8d6844..e2ead655aa8 100644
--- a/usr.bin/mandoc/mdoc_html.c
+++ b/usr.bin/mandoc/mdoc_html.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mdoc_html.c,v 1.94 2015/01/23 14:19:52 schwarze Exp $ */
+/* $OpenBSD: mdoc_html.c,v 1.95 2015/01/30 22:04:15 schwarze Exp $ */
/*
* Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -369,9 +369,10 @@ static void
print_mdoc_nodelist(MDOC_ARGS)
{
- print_mdoc_node(meta, n, h);
- if (n->next)
- print_mdoc_nodelist(meta, n->next, h);
+ while (n != NULL) {
+ print_mdoc_node(meta, n, h);
+ n = n->next;
+ }
}
static void
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 <kristaps@bsd.lv>
* Copyright (c) 2010, 2012-2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -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