chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
780dbee
)
macro: add _unlikely_() to assert_return()
author
Lennart Poettering
<lennart@poettering.net>
Tue, 19 Nov 2013 00:10:40 +0000
(
01:10
+0100)
committer
Lennart 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
patch
|
blob
|
history
diff --git
a/src/shared/macro.h
b/src/shared/macro.h
index 37cdff1cb3065456aad3183359183b7edae58adb..c22de91705fb51b26a74b3075f04d9710969bf75 100644
(file)
--- 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)