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

commit 11ee81c199cd357cb8a5a6928d6ba5beddcbc9fa
parent bbbcd1665d4cd5a25666c4e143469c456e9359ef
Author: Drew DeVault <sir@cmpwn.com>
Date:   Sun,  1 May 2022 14:27:47 +0200

bufio: clarify abort behavior of unread

Signed-off-by: Drew DeVault <sir@cmpwn.com>

Mbufio/buffered.ha | 3++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/bufio/buffered.ha b/bufio/buffered.ha @@ -100,7 +100,8 @@ export fn setflush(s: *bufstream, b: []u8) void = { // data which can be unread before the user makes any reads from a buffered // stream is equal to the length of the read buffer, and otherwise it is equal // to the length of the return value of the last call to [[io::read]] using this -// buffered stream. +// buffered stream. Attempting to unread more data than can fit into the read +// buffer will abort the program. export fn unread(s: *bufstream, buf: []u8) void = { assert(len(s.rbuffer) - s.ravail >= len(buf), "Attempted to unread more data than buffer has available");