aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/u_mem.c
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2026-03-17 18:30:10 +0100
committerlemon <lsof@mailbox.org>2026-03-17 18:30:37 +0100
commit04930d578e65d560253d0c24af43e0ecd06117c8 (patch)
tree6e90f09af0030160dff034bb8e654580779f47a7 /src/u_mem.c
parent3eeb6f219e4d32160fa10895b57a8ddfefff5ff7 (diff)
Refactor: move some utils from antcc.h to their own headers
Diffstat (limited to 'src/u_mem.c')
-rw-r--r--src/u_mem.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/u_mem.c b/src/u_mem.c
index 9495a5f..b1abd2d 100644
--- a/src/u_mem.c
+++ b/src/u_mem.c
@@ -1,38 +1,40 @@
#include "antcc.h"
+#include "u_hash.h"
+#include "u_bits.h"
#include <stdlib.h>
#include <errno.h>
#include <stdint.h>
static void
-allocerr(const char *f)
+allocerr(void)
{
- efmt("%s: %s\n", f, strerror(errno));
+ efmt("antcc fatal: %s\n", strerror(errno));
ioflush(&bstdout);
ioflush(&bstderr);
abort();
}
void *
-(xmalloc)(size_t n, const char *f)
+xmalloc(size_t n)
{
void *p = malloc(n);
- if (!p) allocerr(f);
+ if (!p) allocerr();
return p;
}
void *
-(xcalloc)(size_t n, const char *f)
+xcalloc(size_t n)
{
void *p = calloc(n, 1);
- if (!p) allocerr(f);
+ if (!p) allocerr();
return p;
}
void *
-(xrealloc)(void *p, size_t n, const char *f)
+xrealloc(void *p, size_t n)
{
p = p ? realloc(p, n) : malloc(n);
- if (!p) allocerr(f);
+ if (!p) allocerr();
return p;
}