diff options
Diffstat (limited to 'macros.h')
-rw-r--r-- | macros.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/macros.h b/macros.h new file mode 100644 index 0000000..8b8267a --- /dev/null +++ b/macros.h @@ -0,0 +1,14 @@ +#ifndef MACROS_H +#define MACROS_H + +#define log(priority, ...) syslog(priority, __VA_ARGS__) + +#define did_fail(cond, ...) {\ + if (cond) {\ + log(LOG_ERR, __VA_ARGS__); \ + return -1; \ + }\ +} + +#define did_fail_reason(cond, msg, ...) did_fail(cond, msg " Reason: %s", __VA_ARGS__) +#endif |