diff options
Diffstat (limited to 'include/common.h')
-rw-r--r-- | include/common.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/include/common.h b/include/common.h index 472315e..9f49f55 100644 --- a/include/common.h +++ b/include/common.h @@ -58,6 +58,9 @@ extern "C" { fprintf(stderr, "%s: error!: " fmt "\n", PROGRAM_NAME, ##__VA_ARGS__); \ -1; \ }) +#define errmsg_die(fmt, ...) do { \ + exit(errmsg(fmt, ##__VA_ARGS__)); \ +} while(0) /* System error messages */ #define sys_errmsg(fmt, ...) ({ \ @@ -69,6 +72,9 @@ extern "C" { fprintf(stderr, "error %d (%s)\n", _err, strerror(_err)); \ -1; \ }) +#define sys_errmsg_die(fmt, ...) do { \ + exit(sys_errmsg(fmt, ##__VA_ARGS__)); \ +} while(0) /* Warnings */ #define warnmsg(fmt, ...) do { \ @@ -103,6 +109,8 @@ simple_strtoX(strtoll, long int) simple_strtoX(strtoul, unsigned long int) simple_strtoX(strtoull, unsigned long int) +#include "xalloc.h" + #ifdef __cplusplus } #endif |