summaryrefslogtreecommitdiff
path: root/include/common.h
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2010-09-30 01:27:38 -0400
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2010-09-30 08:54:05 +0300
commitb2dc086600f64d5a2db179fb6bed79a0a78228e4 (patch)
tree9a49989ca2ec2b2ee74f1399be1d9d8469ef8af7 /include/common.h
parent94a20240f9d6776619d7652013bb10131ddad1fc (diff)
mtd-utils: new memory wrappers
The mkfs.jffs2 program has local wrappers for memory related functions that are useful beyond mkfs.jffs2, so break them out into a common header. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'include/common.h')
-rw-r--r--include/common.h8
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