From 9a02dfaefa324ac1e5df3adc11003e1b578cfe64 Mon Sep 17 00:00:00 2001 From: Ludovic Courtes Date: Thu, 13 Jul 2006 12:34:16 +0000 Subject: Made `parse-list-of' tail-recursive. * src/guile/skribilo/skribe/api.scm (parse-list-of): Made tail-recursive, thereby fixing potential stack overflows (e.g., when building the user manual) and perhaps slightly improving performance. git-archimport-id: lcourtes@laas.fr--2005-libre/skribilo--devo--1.2--patch-9 --- src/guile/skribilo/skribe/api.scm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/guile/skribilo/skribe/api.scm b/src/guile/skribilo/skribe/api.scm index 2cd8b2e..2a4d0ae 100644 --- a/src/guile/skribilo/skribe/api.scm +++ b/src/guile/skribilo/skribe/api.scm @@ -551,12 +551,13 @@ (null? (cdr lst))) (parse-list-of for markup (car lst))) (else - (let loop ((lst lst)) + (let loop ((lst lst) + (result '())) (cond ((null? lst) - '()) + (reverse! result)) ((pair? (car lst)) - (loop (car lst))) + (loop (car lst) result)) (else (let ((r (car lst))) (if (not (is-markup? r markup)) @@ -567,7 +568,7 @@ (markup-markup r) (find-runtime-type r)) markup))) - (cons r (loop (cdr lst)))))))))) + (loop (cdr lst) (cons r result))))))))) ;*---------------------------------------------------------------------*/ ;* itemize ... */ -- cgit v1.2.3