summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustus Winter <4winter@informatik.uni-hamburg.de>2014-12-19 01:49:09 +0100
committerJustus Winter <4winter@informatik.uni-hamburg.de>2015-02-20 18:59:50 +0100
commitc2d5ad6f96746593257eb6aba02aae5de3d93664 (patch)
tree7fbf2ffc2064c334c48978c74764988b31feb5fe
parentf2550dfc73da3951b411157d73bb4ad7bd2ea0b2 (diff)
kern: improve assert
Use the ternary operator to implement `assert' like it is done in the glibc. The glibcs changelog does not mention the rationale behind this change, but doing the same seems to improve our IPC performance. * kern/assert.h (assert): Define macro using the ternary operator.
-rw-r--r--kern/assert.h7
1 files changed, 3 insertions, 4 deletions
diff --git a/kern/assert.h b/kern/assert.h
index b074fbb6..bd2a8beb 100644
--- a/kern/assert.h
+++ b/kern/assert.h
@@ -39,10 +39,9 @@
extern void Assert(const char *exp, const char *filename, int line) __attribute__ ((noreturn));
#define assert(ex) \
-MACRO_BEGIN \
- if (!(ex)) \
- Assert(#ex, __FILE__, __LINE__); \
-MACRO_END
+ ((ex) \
+ ? (void) (0) \
+ : Assert (#ex, __FILE__, __LINE__))
#define assert_static(x) assert(x)