hare

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

commit e88492d2c78696639fb98f866cf81cc77764f97e
parent 4564f6bf19ccc41c297dc98c9e96cb09f71b85f8
Author: Lassi Pulkkinen <lassi@pulk.fi>
Date:   Mon, 27 Feb 2023 02:57:18 +0200

bufio: Skip flush byte search when none are set

Signed-off-by: Lassi Pulkkinen <lassi@pulk.fi>

Diffstat:
Mbufio/buffered.ha | 12+++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/bufio/buffered.ha b/bufio/buffered.ha @@ -199,11 +199,13 @@ fn buffered_write(s: *io::stream, buf: const []u8) (size | io::error) = { let buf = buf; let doflush = false; - for (let i = 0z; i < len(buf); i += 1) { - for (let j = 0z; j < len(s.flush); j += 1) { - if (buf[i] == s.flush[j]) { - doflush = true; - break; + if (len(s.flush) != 0) { + for (let i = 0z; i < len(buf); i += 1) :search { + for (let j = 0z; j < len(s.flush); j += 1) { + if (buf[i] == s.flush[j]) { + doflush = true; + break :search; + }; }; }; };