diff options
| author | Baitinq <[email protected]> | 2025-05-31 00:17:07 +0200 |
|---|---|---|
| committer | Baitinq <[email protected]> | 2025-05-31 00:17:07 +0200 |
| commit | 58d01995cc2dc632b63a1b64c2a6ab2723882b02 (patch) | |
| tree | d3774429514fc16de9e6a90035822dd2d6a7d0bb | |
| parent | Bootstrap: Use arena for tokenizer (diff) | |
| download | interpreter-58d01995cc2dc632b63a1b64c2a6ab2723882b02.tar.gz interpreter-58d01995cc2dc632b63a1b64c2a6ab2723882b02.tar.bz2 interpreter-58d01995cc2dc632b63a1b64c2a6ab2723882b02.zip | |
std: Use calloc in arena implementation
| -rw-r--r-- | std/mem.src | 6 |
1 files changed, 3 insertions, 3 deletions
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; }; |