From 58d01995cc2dc632b63a1b64c2a6ab2723882b02 Mon Sep 17 00:00:00 2001 From: Baitinq Date: Sat, 31 May 2025 00:17:07 +0200 Subject: std: Use calloc in arena implementation --- std/mem.src | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'std/mem.src') diff --git a/std/mem.src b/std/mem.src index 1e05c81..3bb1a0a 100644 --- a/std/mem.src +++ b/std/mem.src @@ -1,4 +1,4 @@ -extern malloc = (i64) => *void; +extern calloc = (i64, i64) => *void; extern realloc = (*void, i64) => *void; extern free = (*void) => void; @@ -10,8 +10,8 @@ let arena = struct { }; let arena_init = (size: i64) => *arena { - let a = cast(*arena, malloc(sizeof(arena))); - (*a).buf = malloc(size); + let a = cast(*arena, calloc(1, sizeof(arena))); + (*a).buf = calloc(1, size); (*a).offset = 0; return a; }; -- cgit 1.4.1