aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2024-06-24 17:09:50 +0200
committerThomas Voss <mail@thomasvoss.com> 2024-06-24 17:10:37 +0200
commit5d25f6018fa6e935f8e151dbaacc2d5499831bda (patch)
treef7a6d79184a8625622f3078a2ebf11b78e2efc0f
parent660910491913624f6835825c1181b10831b4a0bc (diff)
Replace ‘bufalloc(); malloc()’ with calloc()
-rw-r--r--src/analyzer.c8
1 files changed, 4 insertions, 4 deletions
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);
}