From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from localhost (fantadrom.bsd.lv [local]); by fantadrom.bsd.lv (OpenSMTPD) with ESMTPA id fe655377; for ; Fri, 30 Jan 2015 17:05:15 -0500 (EST) Date: Fri, 30 Jan 2015 17:05:15 -0500 (EST) Message-Id: <18147683448759912642.enqueue@fantadrom.bsd.lv> X-Mailinglist: mdocml-source Reply-To: source@mdocml.bsd.lv MIME-Version: 1.0 From: schwarze@mdocml.bsd.lv To: source@mdocml.bsd.lv Subject: mdocml: Have pity on the poor stack. X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-8 Log Message: ----------- Have pity on the poor stack. Replace tail recursion by iteration when walking the syntax trees. No functional change. Modified Files: -------------- mdocml: man_html.c man_term.c mdoc_html.c mdoc_term.c Revision Data ------------- Index: mdoc_term.c =================================================================== RCS file: /home/cvs/mdocml/mdocml/mdoc_term.c,v retrieving revision 1.303 retrieving revision 1.304 diff -Lmdoc_term.c -Lmdoc_term.c -u -p -r1.303 -r1.304 --- mdoc_term.c +++ mdoc_term.c @@ -291,9 +291,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 Index: man_term.c =================================================================== RCS file: /home/cvs/mdocml/mdocml/man_term.c,v retrieving revision 1.167 retrieving revision 1.168 diff -Lman_term.c -Lman_term.c -u -p -r1.167 -r1.168 --- man_term.c +++ man_term.c @@ -1,7 +1,7 @@ /* $Id$ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons - * Copyright (c) 2010-2014 Ingo Schwarze + * Copyright (c) 2010-2015 Ingo Schwarze * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -1007,10 +1007,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 Index: man_html.c =================================================================== RCS file: /home/cvs/mdocml/mdocml/man_html.c,v retrieving revision 1.109 retrieving revision 1.110 diff -Lman_html.c -Lman_html.c -u -p -r1.109 -r1.110 --- man_html.c +++ man_html.c @@ -1,7 +1,7 @@ /* $Id$ */ /* * Copyright (c) 2008-2012, 2014 Kristaps Dzonsons - * Copyright (c) 2013, 2014 Ingo Schwarze + * Copyright (c) 2013, 2014, 2015 Ingo Schwarze * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -192,9 +192,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 Index: mdoc_html.c =================================================================== RCS file: /home/cvs/mdocml/mdocml/mdoc_html.c,v retrieving revision 1.219 retrieving revision 1.220 diff -Lmdoc_html.c -Lmdoc_html.c -u -p -r1.219 -r1.220 --- mdoc_html.c +++ mdoc_html.c @@ -371,9 +371,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 -- To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv