From 5d25f6018fa6e935f8e151dbaacc2d5499831bda Mon Sep 17 00:00:00 2001
From: Thomas Voss <mail@thomasvoss.com>
Date: Mon, 24 Jun 2024 17:09:50 +0200
Subject: Replace ‘bufalloc(); malloc()’ with calloc()
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/analyzer.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

(limited to 'src')

diff --git a/src/analyzer.c b/src/analyzer.c
index 8c8e7ab..4b2034b 100644
--- a/src/analyzer.c
+++ b/src/analyzer.c
@@ -105,15 +105,15 @@ void
 analyzeprog(ast_t ast, aux_t aux, lexemes_t toks, arena_t *a, type_t **types,
             scope_t **scps, mpq_t **folds)
 {
-	*types = bufalloc(NULL, ast.len, sizeof(**types));
-	memset(*types, 0, ast.len * sizeof(**types));
+	if ((*types = calloc(ast.len, sizeof(**types))) == NULL)
+		err("calloc:");
 
 	*scps = gensymtabs(ast, aux, toks, a);
 	analyzeast(*scps, *types, ast, aux, toks, a);
 
 	scratch_t s = {0};
-	*folds = bufalloc(NULL, ast.len, sizeof(**folds));
-	memset(*folds, 0, ast.len * sizeof(**folds));
+	if ((*folds = calloc(ast.len, sizeof(**folds))) == NULL)
+		err("calloc:");
 	constfold(*folds, *scps, *types, ast, toks, a, &s);
 }
 
-- 
cgit v1.2.3