From 319149507a6b69262a14609c11eb1ed0dc983b5b Mon Sep 17 00:00:00 2001 From: dlichteblau Date: Wed, 3 Oct 2007 15:21:56 +0000 Subject: [PATCH] Fixed time and space usage in cases where entity references follow each other (thanks to Ivan Shvedunov for the report). * xml/xml-parse.lisp (P/CONTENT): Removed useless call to append. Use loop instead of tail recursion. --- xml/xml-parse.lisp | 72 +++++++++++++++++++++------------------------- 1 file changed, 33 insertions(+), 39 deletions(-) diff --git a/xml/xml-parse.lisp b/xml/xml-parse.lisp index 73fa41a..bce6458 100644 --- a/xml/xml-parse.lisp +++ b/xml/xml-parse.lisp @@ -2800,45 +2800,39 @@ (defun p/content (input) ;; [43] content ::= (element | CharData | Reference | CDSect | PI | Comment)* - (multiple-value-bind (cat sem) (peek-token input) - (case cat - ((:stag :ztag) - (p/element input) - (p/content input)) - ((:CDATA) - (process-characters input sem) - (sax:characters (handler *ctx*) sem) - (p/content input)) - ((:ENTITY-REF) - (let ((name sem)) - (consume-token input) - (append - (recurse-on-entity input name :general - (lambda (input) - (prog1 - (etypecase (checked-get-entdef name :general) - (internal-entdef (p/content input)) - (external-entdef (p/ext-parsed-ent input))) - (unless (eq (peek-token input) :eof) - (wf-error input "Trailing garbage. - ~S" - (peek-token input)))))) - (p/content input)))) - ((: