commit db463436c3f01a90b3d77c50bcfdf5cd0655cc3f parent ac0ca9763fd13895b3933e86e6376cabf33f38d5 Author: Yuval Langer <yuval.langer@gmail.com> Date: Tue, 9 Jan 2024 01:32:48 +0200 Write bytes to an output-bytevector instead of appending a bytevector to a bytevector. Diffstat:
M | rsv/arbitrary-null.scm | | | 16 | +++++++++------- |
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/rsv/arbitrary-null.scm b/rsv/arbitrary-null.scm @@ -57,13 +57,15 @@ (read-u8 port) ;; remove value terminator byte. "") (byte - (let loop ((field #u8())) - (match (read-u8 port) - ((? value-terminator-byte? byte) - (utf8->string field)) - (byte - (loop (bytevector-append field - (make-bytevector 1 byte))))))))) + (let ((output-field-port (open-output-bytevector))) + (let loop () + (match (read-u8 port) + ((? value-terminator-byte? byte) + (utf8->string (get-output-bytevector output-field-port))) + (byte + (write-u8 byte + output-field-port) + (loop)))))))) (define (row->scm null-value port) (match (peek-u8 port)