config: handle allocation failure explicitly

This commit is contained in:
Craig Barnes 2020-08-04 23:28:16 +01:00
parent c07d14e1c0
commit f1fce96a1d
6 changed files with 223 additions and 68 deletions

10
xmalloc.h Normal file
View file

@ -0,0 +1,10 @@
#pragma once
#include <stddef.h>
#include <string.h>
#include "macros.h"
void *xmalloc(size_t size) XMALLOC;
void *xcalloc(size_t nmemb, size_t size) XMALLOC;
char *xstrdup(const char *str) XSTRDUP;
char *xasprintf(const char *format, ...) PRINTF(1) XMALLOC;