diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-10-15 11:43:57 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-10-15 11:43:57 +0100 |
commit | dd72c18a0819728368d5fead9d22bd518624ae51 (patch) | |
tree | e0e943fff140b75b5d5fb4ed59150ca49ae64c7e /contrib/libottery | |
parent | 6ceac089b6a8fee5aef14307b0561e98202947c5 (diff) | |
download | rspamd-dd72c18a0819728368d5fead9d22bd518624ae51.tar.gz rspamd-dd72c18a0819728368d5fead9d22bd518624ae51.zip |
Another GCCism.
Diffstat (limited to 'contrib/libottery')
-rw-r--r-- | contrib/libottery/ottery_global.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/contrib/libottery/ottery_global.c b/contrib/libottery/ottery_global.c index 8b4a6300e..db8d48ac4 100644 --- a/contrib/libottery/ottery_global.c +++ b/contrib/libottery/ottery_global.c @@ -21,7 +21,11 @@ * Evaluate the condition 'x', while hinting to the compiler that it is * likely to be false. */ +#ifdef __GNUC__ #define UNLIKELY(x) __builtin_expect((x), 0) +#else +#define UNLIKELY(x) +#endif /** Flag: true iff ottery_global_state_ is initialized. */ static int ottery_global_state_initialized_ = 0; @@ -31,13 +35,13 @@ static struct ottery_state ottery_global_state_; /** Initialize ottery_global_state_ if it has not been initialize. */ #define CHECK_INIT(rv) do { \ - if (UNLIKELY(!ottery_global_state_initialized_)) { \ - int err; \ - if ((err = ottery_init(NULL))) { \ - ottery_fatal_error_(OTTERY_ERR_FLAG_GLOBAL_PRNG_INIT|err); \ - return rv; \ - } \ - } \ + if (UNLIKELY(!ottery_global_state_initialized_)) { \ + int err; \ + if ((err = ottery_init(NULL))) { \ + ottery_fatal_error_(OTTERY_ERR_FLAG_GLOBAL_PRNG_INIT|err); \ + return rv; \ + } \ + } \ } while (0) int @@ -45,7 +49,7 @@ ottery_init(const struct ottery_config *cfg) { int n = ottery_st_init(&ottery_global_state_, cfg); if (n == 0) - ottery_global_state_initialized_ = 1; + ottery_global_state_initialized_ = 1; return n; } @@ -60,8 +64,8 @@ void ottery_wipe(void) { if (ottery_global_state_initialized_) { - ottery_global_state_initialized_ = 0; - ottery_st_wipe(&ottery_global_state_); + ottery_global_state_initialized_ = 0; + ottery_st_wipe(&ottery_global_state_); } } |