]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
macro: add _unlikely_() to assert_return()
authorLennart Poettering <lennart@poettering.net>
Tue, 19 Nov 2013 00:10:40 +0000 (01:10 +0100)
committerLennart Poettering <lennart@poettering.net>
Wed, 20 Nov 2013 18:36:14 +0000 (19:36 +0100)
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.

src/shared/macro.h

index 37cdff1cb3065456aad3183359183b7edae58adb..c22de91705fb51b26a74b3075f04d9710969bf75 100644 (file)
@@ -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)