diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-06-17 10:37:43 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-06-17 10:37:43 +0200 |
commit | 59787a5c664ddfe0ed0f39e434078e593b29218b (patch) | |
tree | 00db7380b775d39eda3ddb0ea1bfbe6f79491100 /src/basic/macro.h | |
parent | a028d19ba5d866c36d1c647a24cfba889cd28a9d (diff) | |
parent | 366e641139130833a7354d9f2f96ce72633b1053 (diff) |
Merge pull request #239 from dvdhrm/event-assert
sd-event: make errors on EPOLL_CTL_DEL pseudo-fatal
Diffstat (limited to 'src/basic/macro.h')
-rw-r--r-- | src/basic/macro.h | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/basic/macro.h b/src/basic/macro.h index cc1c9e73c0..5fa17ed208 100644 --- a/src/basic/macro.h +++ b/src/basic/macro.h @@ -248,18 +248,19 @@ static inline unsigned long ALIGN_POWER2(unsigned long u) { REENABLE_WARNING #endif +#define assert_log(expr) ((_likely_(expr)) \ + ? (true) \ + : (log_assert_failed_return(#expr, __FILE__, __LINE__, __PRETTY_FUNCTION__), false)) + #define assert_return(expr, r) \ do { \ - if (_unlikely_(!(expr))) { \ - log_assert_failed_return(#expr, __FILE__, __LINE__, __PRETTY_FUNCTION__); \ + if (!assert_log(expr)) \ return (r); \ - } \ } while (false) #define assert_return_errno(expr, r, err) \ do { \ - if (_unlikely_(!(expr))) { \ - log_assert_failed_return(#expr, __FILE__, __LINE__, __PRETTY_FUNCTION__); \ + if (!assert_log(expr)) { \ errno = err; \ return (r); \ } \ |