From: Lennart Poettering Date: Tue, 19 Nov 2013 00:10:40 +0000 (+0100) Subject: macro: add _unlikely_() to assert_return() X-Git-Tag: v209~1393 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=d3cfcae9db39b0cd01bd8c3db1dc57d6a04554a4;p=elogind.git macro: add _unlikely_() to assert_return() As the name indicates assert_return() is really just for assertions, i.e. where it's a programming error if the assertion does not hold. Hence it is safe to add _unlikely_() decorators for the expression to check. --- diff --git a/src/shared/macro.h b/src/shared/macro.h index 37cdff1cb..c22de9170 100644 --- a/src/shared/macro.h +++ b/src/shared/macro.h @@ -150,7 +150,7 @@ static inline size_t ALIGN_TO(size_t l, size_t ali) { #define assert_return(expr, r) \ do { \ - if (!(expr)) \ + if (_unlikely_(!(expr))) \ return (r); \ } while (false)