aboutsummaryrefslogtreecommitdiff
path: root/xmalloc.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2021-01-20 16:47:05 +0000
committerDaniel Eklöf <daniel@ekloef.se>2021-01-20 16:47:05 +0000
commitc5031be4899ea516635ef7c65a6f82b3b45860b9 (patch)
tree10948eb4aface28e80d6a075fecf11fad3075618 /xmalloc.c
parentMerge branch 'decset-1047-and-1048' (diff)
parentdebug: rename assert() to xassert(), to avoid clashing with <assert.h> (diff)
Merge branch 'stacktrace'
Diffstat (limited to 'xmalloc.c')
-rw-r--r--xmalloc.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/xmalloc.c b/xmalloc.c
index a9a6685c..16b3565a 100644
--- a/xmalloc.c
+++ b/xmalloc.c
@@ -1,21 +1,11 @@
-#include <assert.h>
#include <errno.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <wchar.h>
-#include <syslog.h>
#include "xmalloc.h"
-
-static NORETURN COLD void
-fatal_error(const char *msg, int err)
-{
- syslog(LOG_ERR, "%s: %s", msg, strerror(err));
- errno = err;
- perror(msg);
- abort();
-}
+#include "debug.h"
static void *
check_alloc(void *alloc)
@@ -38,7 +28,7 @@ xmalloc(size_t size)
void *
xcalloc(size_t nmemb, size_t size)
{
- assert(size != 0);
+ xassert(size != 0);
return check_alloc(calloc(likely(nmemb) ? nmemb : 1, size));
}