hare

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

commit 12807d50e209c83ba49171f80b7f5b1812938714
parent 58f4416a8ecfeeed550b78531226b203130db7a8
Author: Sertonix <sertonix@posteo.net>
Date:   Fri, 27 Oct 2023 08:39:18 +0000

memio: return io::EOF on 0 bytes read

This makes the behaviour more consistent with other io streams. Most
notably when reading a 0 size buffer after EOF.

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

diff --git a/memio/stream.ha b/memio/stream.ha @@ -91,7 +91,7 @@ export fn borrowedread(st: *stream, amt: size) ([]u8 | io::EOF) = { fn read(s: *io::stream, buf: []u8) (size | io::EOF | io::error) = { let s = s: *stream; - if (len(s.buf) == s.pos && len(buf) != 0) { + if (len(s.buf) == s.pos) { return io::EOF; }; const n = if (len(s.buf) - s.pos < len(buf)) {