hare

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

commit 80827d904f7bd05b4dbbd04527f579239e427aa5
parent 4a26f779fee3e6d44a773dce7a0f63d0f5cd8c91
Author: Drew DeVault <sir@cmpwn.com>
Date:   Tue,  2 Feb 2021 14:36:29 -0500

os::fdstream: simplify switch usage

Diffstat:
Mos/+linux/fdstream.ha | 5++---
Mrt/+linux/segmalloc.ha | 4+++-
2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/os/+linux/fdstream.ha b/os/+linux/fdstream.ha @@ -50,9 +50,8 @@ fn fd_read(s: *io::stream, buf: []u8) (size | io::EOF | io::error) = { return match (rt::wrap_return(r)) { err: rt::errno => errno_to_io(err), n: size => switch (n) { - // TODO: Fix me when swich is fixed up - 0z => io::EOF: (size | io::EOF | io::error), - * => n: (size | io::EOF | io::error), + 0z => io::EOF, + * => n, }, }; }; diff --git a/rt/+linux/segmalloc.ha b/rt/+linux/segmalloc.ha @@ -4,7 +4,9 @@ fn segmalloc(n: size) nullable *void = { PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0z); // TODO: remove the cast to nullable *void - return if (p: uintptr: int == -ENOMEM) null: nullable *void else p: nullable *void; + return if (p: uintptr: int == -ENOMEM) + null: nullable *void + else p: nullable *void; }; // Frees a segment allocated with segmalloc.