From b52ecd51f28d1530073d155670bad2919f2cfca6 Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Mon, 18 Nov 2019 22:46:03 -0800 Subject: [PATCH] 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. --- src/runtime/string.scm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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))) -- 2.25.1