From f3988a4c51e1dee91488e6a26294b159e0990346 Mon Sep 17 00:00:00 2001 From: "Taylor R. Campbell" Date: Mon, 25 Aug 2008 21:11:12 +0000 Subject: [PATCH] Behave as before with no prefix given to INPUT-PORT->PARSER-BUFFER; don't spin endlessly trying to double 0 until it exceeds the minimum length. --- v7/src/runtime/parser-buffer.scm | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/v7/src/runtime/parser-buffer.scm b/v7/src/runtime/parser-buffer.scm index 78d1d14a9..e6ec3e30c 100644 --- a/v7/src/runtime/parser-buffer.scm +++ b/v7/src/runtime/parser-buffer.scm @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Id: parser-buffer.scm,v 1.23 2008/08/18 06:56:10 cph Exp $ +$Id: parser-buffer.scm,v 1.24 2008/08/25 21:11:12 riastradh Exp $ Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, @@ -77,15 +77,16 @@ USA. (define (input-port->parser-buffer port #!optional prefix) (guarantee-input-port port 'INPUT-PORT->PARSER-BUFFER) - (let ((prefix - (if (or (default-object? prefix) (not prefix)) - (make-wide-string 0) - (begin - (guarantee-wide-string prefix 'INPUT-PORT->PARSER-BUFFER) - prefix)))) - (let ((n (wide-string-length prefix))) - (make-parser-buffer (%grow-buffer prefix n (max min-length n)) - 0 n 0 0 port #f 0)))) + (if (or (default-object? prefix) + (not prefix) + (and (wide-string? prefix) + (zero? (wide-string-length prefix)))) + (make-parser-buffer (make-wide-string min-length) 0 0 0 0 port #f 0) + (begin + (guarantee-wide-string prefix 'INPUT-PORT->PARSER-BUFFER) + (let ((n (wide-string-length prefix))) + (make-parser-buffer (%grow-buffer prefix n (max min-length n)) + 0 n 0 0 port #f 0))))) (define-integrable min-length 256) -- 2.25.1