about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBaitinq <[email protected]>2025-05-31 00:17:07 +0200
committerBaitinq <[email protected]>2025-05-31 00:17:07 +0200
commit58d01995cc2dc632b63a1b64c2a6ab2723882b02 (patch)
treed3774429514fc16de9e6a90035822dd2d6a7d0bb
parentBootstrap: Use arena for tokenizer (diff)
downloadpry-lang-58d01995cc2dc632b63a1b64c2a6ab2723882b02.tar.gz
pry-lang-58d01995cc2dc632b63a1b64c2a6ab2723882b02.tar.bz2
pry-lang-58d01995cc2dc632b63a1b64c2a6ab2723882b02.zip
std: Use calloc in arena implementation
-rw-r--r--std/mem.src6
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;
 };