From fa2f322580bba3ff71053c895f658ecb4116a456 Mon Sep 17 00:00:00 2001 From: Louis Burda Date: Mon, 14 Feb 2022 12:46:09 +0100 Subject: Improve error handling, history bug fix --- src/util.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/util.h') diff --git a/src/util.h b/src/util.h index 2f0c8ca..c45d03e 100644 --- a/src/util.h +++ b/src/util.h @@ -9,6 +9,8 @@ #define PANIC(...) panic(__FILE__, __LINE__, "" __VA_ARGS__) #define ASSERT(x) assert((x), __FILE__, __LINE__, #x) +#define OOM_CHECK(x) assert((x) != NULL, __FILE__, __LINE__, "Out of Memory!") +#define ERROR(...) error("" __VA_ARGS__) #define LINK(p) (&(p)->link) #define UPCAST(iter, type) LINK_UPCAST(iter, type, link) @@ -17,6 +19,7 @@ int strnwidth(const char *s, int n); void panic(const char *file, int line, const char *msg, ...); void assert(int cond, const char *file, int line, const char *condstr); +void error(const char *fmtstr, ...); char *aprintf(const char *fmtstr, ...); wchar_t *awprintf(const wchar_t *fmtstr, ...); -- cgit v1.2.3-71-gd317