diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2020-09-08 13:18:25 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2020-09-08 17:40:46 +0200 |
commit | 44f0dd628ce4ca9565b0e02b8cb63ed8272529cd (patch) | |
tree | d3fb2ad04856a64b11cecde062b069ecd27349b5 /src/basic/log.h | |
parent | tree-wide: correct cases where return log_{error,warning} is used without value (diff) | |
download | systemd-44f0dd628ce4ca9565b0e02b8cb63ed8272529cd.tar.xz systemd-44f0dd628ce4ca9565b0e02b8cb63ed8272529cd.zip |
basic/log: make log_{info,warning,...} return void
log_debug still returns 0. I think it is legitimate to use 'return log_debug()' to
return 0. It is different than the other functions, since we often want to supress
errors logged at debug level. This case is quite common in the codebase and
we could use 'return log_debug_errno()' to make the code more consise.
For all other variants, a separate return line is required.
Previous commit changes all the non-conforming instances, now we can make it mandatory.
Diffstat (limited to 'src/basic/log.h')
-rw-r--r-- | src/basic/log.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/basic/log.h b/src/basic/log.h index 15807d3029..137d21005d 100644 --- a/src/basic/log.h +++ b/src/basic/log.h @@ -234,12 +234,12 @@ void log_assert_failed_return_realm( #define log_full_errno(level, error, ...) \ log_full_errno_realm(LOG_REALM, (level), (error), __VA_ARGS__) -#define log_full(level, ...) log_full_errno((level), 0, __VA_ARGS__) +#define log_full(level, ...) (void) log_full_errno((level), 0, __VA_ARGS__) int log_emergency_level(void); /* Normal logging */ -#define log_debug(...) log_full(LOG_DEBUG, __VA_ARGS__) +#define log_debug(...) log_full_errno(LOG_DEBUG, 0, __VA_ARGS__) #define log_info(...) log_full(LOG_INFO, __VA_ARGS__) #define log_notice(...) log_full(LOG_NOTICE, __VA_ARGS__) #define log_warning(...) log_full(LOG_WARNING, __VA_ARGS__) |