From 960f79fa50009fd1e95a294547e3e46494d49484 Mon Sep 17 00:00:00 2001 From: lemon Date: Wed, 17 Sep 2025 09:49:22 +0200 Subject: alloc changes --- mem.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'mem.c') diff --git a/mem.c b/mem.c index 8ed87eb..7faadc6 100644 --- a/mem.c +++ b/mem.c @@ -10,6 +10,14 @@ abort(); \ } while (0) +void * +(xmalloc)(size_t n, const char *f) +{ + void *p = malloc(n); + if (!p) ALLOCERR(f); + return p; +} + void * (xcalloc)(size_t n, const char *f) { @@ -84,7 +92,7 @@ vresize_(void **p, int *pcap, uint *pn, uint siz, uint N) struct arena * newarena(uint chunksiz) { - struct arena *ar = xcalloc(offsetof(struct arena, mem) + chunksiz); + struct arena *ar = xmalloc(offsetof(struct arena, mem) + chunksiz); assert(chunksiz < 1u<<31 && "toobig"); ar->cap = chunksiz; ar->dyn = 1; -- cgit v1.2.3