hare

[hare] The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit 76a742dd13ad615ff3fd854d54b5849e62bf65be
parent 31f2b5ab2bf26bf7c89c30bae896884865561e04
Author: Drew DeVault <sir@cmpwn.com>
Date:   Wed,  9 Aug 2023 12:30:26 +0200

memio: truncate on reset()

Otherwise this leaves the buffer full of earlier writes. memio::buffer()
should return [] following reset.

Diffstat:
Mmemio/stream.ha | 1+
1 file changed, 1 insertion(+), 0 deletions(-)

diff --git a/memio/stream.ha b/memio/stream.ha @@ -76,6 +76,7 @@ export fn string(in: *stream) (str | utf8::invalid) = { // the buffer can be overwritten and reused. export fn reset(in: *stream) void = { in.pos = 0; + in.buf = in.buf[..0]; }; // Reads data from a [[dynamic]] or [[fixed]] stream and returns a slice