commit 9ca09d9ad295e3460f95e0a018943393ed2bad72
parent 3928a02c5cc148fa9c14645627695e1f038784a0
Author: Sebastian <sebastian@sebsite.pw>
Date: Tue, 22 Feb 2022 18:51:53 -0500
rt: update malloc+debug.ha
Signed-off-by: Sebastian <sebastian@sebsite.pw>
Diffstat:
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/rt/malloc+debug.ha b/rt/malloc+debug.ha
@@ -22,10 +22,10 @@ type auxv64 = struct {
@init fn init() void = {
let i = 0;
- for (rt::envp[i] != null) {
+ for (envp[i] != null) {
i += 1;
};
- let auxv = &rt::envp[i + 1]: *[*]auxv64;
+ let auxv = &envp[i + 1]: *[*]auxv64;
for (let i = 0z; auxv[i].a_type != 0; i += 1) {
if (auxv[i].a_type == AUXV_PAGESZ) {
pagesz = auxv[i].a_val: size;
@@ -43,8 +43,10 @@ export fn malloc(n: size) nullable *void = {
z += pagesz - z % pagesz;
};
let seg = match (segmalloc(z)) {
- null => return null,
- ptr: *void => ptr,
+ case null =>
+ return null;
+ case let ptr: *void =>
+ yield ptr;
};
let user = &(seg: *[*]u8)[z - n];
let segptr = &(user: *[*]*void)[-1];