From: Chris Hanson Date: Tue, 19 Nov 2019 06:46:03 +0000 (-0800) Subject: Allow string-builder to take a zero argument. X-Git-Tag: mit-scheme-pucked-10.1.20~11^2~3 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=b52ecd51f28d1530073d155670bad2919f2cfca6;p=mit-scheme.git Allow string-builder to take a zero argument. This simplifies cases where the length of the result is known in advance and passed as the buffer size. --- diff --git a/src/runtime/string.scm b/src/runtime/string.scm index 5e78396e2..660da8ec5 100644 --- a/src/runtime/string.scm +++ b/src/runtime/string.scm @@ -590,8 +590,8 @@ USA. (if (default-object? buffer-length) 1024 (begin - (guarantee positive-fixnum? buffer-length 'string-builder) - buffer-length))))) + (guarantee non-negative-fixnum? buffer-length 'string-builder) + (fix:max 1 buffer-length)))))) (let ((append-char! (builder 'append-char!)) (append-string! (builder 'append-string!)) (build (builder 'build)))