This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch

[PATCH hare] bufio: return utf8::invalid in more cases

Message ID
DKIM signature
Download raw message
Patch: +6 -2
Both io::underread and utf8::more result in the function returning
utf8::invalid, since these are only possible if the codepoint is

Signed-off-by: Sebastian <sebastian@sebsite.pw>
 bufio/scanner.ha | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/bufio/scanner.ha b/bufio/scanner.ha
index 3e24cb87..b900698d 100644
--- a/bufio/scanner.ha
@@ -74,18 +74,22 @@ export fn scanrune(
		return b[0]: u32: rune;

	match (io::readall(file, b[1..sz])?) {
	match (io::readall(file, b[1..sz])) {
	case let n: size => void;
	case io::EOF =>
		return io::EOF;
	case let err: io::error =>
		return if (err is io::underread) utf8::invalid else err;

	let dec = utf8::decode(b[..sz]);
	match (utf8::next(&dec)?) {
	case let r: rune =>
		return r;
	case (void | utf8::more) =>
	case void =>
		return io::EOF;
	case utf8::more =>
		return utf8::invalid;


[hare/patches] build success

builds.sr.ht <builds@sr.ht>
Message ID
<20220623232359.31229-1-sebastian@sebsite.pw> (view parent)
DKIM signature
Download raw message
hare/patches: SUCCESS in 1m30s

[bufio: return utf8::invalid in more cases][0] from [Sebastian][1]

[0]: https://lists.sr.ht/~sircmpwn/hare-dev/patches/33238
[1]: sebastian@sebsite.pw

✓ #786653 SUCCESS hare/patches/alpine.yml  https://builds.sr.ht/~sircmpwn/job/786653
✓ #786654 SUCCESS hare/patches/freebsd.yml https://builds.sr.ht/~sircmpwn/job/786654
Reply to thread Export thread (mbox)