projects
/
mit-scheme.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a90dfb5
)
Allow string-builder to take a zero argument.
author
Chris Hanson
<org/chris-hanson/cph>
Tue, 19 Nov 2019 06:46:03 +0000
(22:46 -0800)
committer
Chris Hanson
<org/chris-hanson/cph>
Wed, 20 Nov 2019 03:06:01 +0000
(19:06 -0800)
This simplifies cases where the length of the result is known in advance and
passed as the buffer size.
src/runtime/string.scm
patch
|
blob
|
history
diff --git
a/src/runtime/string.scm
b/src/runtime/string.scm
index 5e78396e249fca4a867d2fd414210a96ca40ebe8..660da8ec5da450faf1dcb361cc5636b80ba6ac58 100644
(file)
--- a/
src/runtime/string.scm
+++ b/
src/runtime/string.scm
@@
-590,8
+590,8
@@
USA.
(if (default-object? buffer-length)
1024
(begin
- (guarantee
posi
tive-fixnum? buffer-length 'string-builder)
-
buffer-length
)))))
+ (guarantee
non-nega
tive-fixnum? buffer-length 'string-builder)
+
(fix:max 1 buffer-length)
)))))
(let ((append-char! (builder 'append-char!))
(append-string! (builder 'append-string!))
(build (builder 'build)))