hare

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

commit 654679e1b767535f1a77cb03ccc83cd91a6e6268
parent 0b88c0de33fc837e388247eb00bd1d9bcfb73e52
Author: Drew DeVault <sir@cmpwn.com>
Date:   Fri,  5 Feb 2021 14:01:15 -0500

rt: update alloc following if changes

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

diff --git a/rt/+linux/segmalloc.ha b/rt/+linux/segmalloc.ha @@ -4,9 +4,7 @@ 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 else p; }; // Frees a segment allocated with segmalloc. diff --git a/rt/malloc.ha b/rt/malloc.ha @@ -77,14 +77,14 @@ fn malloc_small(n: size) nullable *void = { return if (p != null: nullable *void) { let q = *(p: **void); bins[b] = q; - p: nullable *void; - } else null: nullable *void; + p; + } else null; }; fn fill_bin(b: size) nullable *void = { const s = bin2size(b); let p = segmalloc(BIGBLOCK); - return if (p == null: nullable *void) null: nullable *void + return if (p == null: nullable *void) null else list_from_block(s, p: uintptr); };