summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
authorMichal Schmidt <mschmidt@redhat.com>2014-11-28 19:57:32 +0100
committerAnthony G. Basile <blueness@gentoo.org>2014-12-01 13:13:40 -0500
commitf460aa149c21c920e1a3090a16877937c49b4813 (patch)
treeede02852a05f16790224d29a48de551b8ab87d8d /src/shared
parent761b969283f415df75efe2ffb772a62b23379222 (diff)
treewide: another round of simplifications
Using the same scripts as in f647962d64e "treewide: yet more log_*_errno + return simplifications". Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/log.h13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/shared/log.h b/src/shared/log.h
index 3e317a5e94..8eda7bf695 100644
--- a/src/shared/log.h
+++ b/src/shared/log.h
@@ -89,11 +89,13 @@ noreturn void log_assert_failed_unreachable(
/* Logging with level */
-#define log_full_errno(level, error, ...) \
- do { \
- if (log_get_max_level() >= (level)) \
- log_internal((level), error, __FILE__, __LINE__, __func__, __VA_ARGS__); \
- } while (false)
+#define log_full_errno(level, error, ...) \
+ ({ \
+ int _l = (level), _e = (error); \
+ (log_get_max_level() >= _l) \
+ ? log_internal(_l, _e, __FILE__, __LINE__, __func__, __VA_ARGS__) \
+ : -abs(_e); \
+ })
#define log_full(level, ...) log_full_errno(level, 0, __VA_ARGS__)
@@ -120,7 +122,6 @@ noreturn void log_assert_failed_unreachable(
#endif
/* This modifies the buffer passed! */
-//#define log_dump(level, buffer) log_dump_internal(level, 0, __FILE__, __LINE__, __func__, buffer)
#define log_oom() log_oom_internal(__FILE__, __LINE__, __func__)