From 852c2ac1583ec9a7033626b93c8e894083ceaae3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=99emysl=20Janouch?= Date: Sat, 2 May 2015 03:43:29 +0200 Subject: Move some macros to common.c --- common.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'common.c') diff --git a/common.c b/common.c index 3145f74..6210011 100644 --- a/common.c +++ b/common.c @@ -34,6 +34,19 @@ #include #include +/// Shorthand to set an error and return failure from the function +#define FAIL(...) \ + BLOCK_START \ + error_set (e, __VA_ARGS__); \ + return false; \ + BLOCK_END + +// A few other debugging shorthands +#define LOG_FUNC_FAILURE(name, desc) \ + print_debug ("%s: %s: %s", __func__, (name), (desc)) +#define LOG_LIBC_FAILURE(name) \ + print_debug ("%s: %s: %s", __func__, (name), strerror (errno)) + // --- Logging ----------------------------------------------------------------- static void -- cgit v1.2.3