mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-04-29 10:32:00 +00:00
babeld, lib, nhrpd: Add likely and unlikely macros
We have 2 competing versions of likely and unlikely in babeld and nhrpd. Standardize onto lower case versions and consolidate in the code. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This commit is contained in:
parent
9cc377d4d7
commit
6a72124df9
@ -442,7 +442,9 @@ babel_fill_with_next_timeout(struct timeval *tv)
|
||||
#define printIfMin(a,b,c,d)
|
||||
#else
|
||||
#define printIfMin(a, b, c, d) \
|
||||
if (UNLIKELY(debug & BABEL_DEBUG_TIMEOUT)) {printIfMin(a,b,c,d);}
|
||||
if (unlikely(debug & BABEL_DEBUG_TIMEOUT)) { \
|
||||
printIfMin(a, b, c, d); \
|
||||
}
|
||||
|
||||
struct vrf *vrf = vrf_lookup_by_id(VRF_DEFAULT);
|
||||
struct interface *ifp = NULL;
|
||||
|
@ -26,12 +26,8 @@ Copyright 2011 by Matthieu Boutier and Juliusz Chroboczek
|
||||
|
||||
#if defined(__GNUC__) && (__GNUC__ >= 3)
|
||||
#define ATTRIBUTE(x) __attribute__ (x)
|
||||
#define LIKELY(_x) __builtin_expect(!!(_x), 1)
|
||||
#define UNLIKELY(_x) __builtin_expect(!!(_x), 0)
|
||||
#else
|
||||
#define ATTRIBUTE(x) /**/
|
||||
#define LIKELY(_x) !!(_x)
|
||||
#define UNLIKELY(_x) !!(_x)
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) && (__GNUC__ >= 4) && (__GNUC_MINOR__ >= 3)
|
||||
|
@ -124,7 +124,8 @@ extern const unsigned char v4prefix[16];
|
||||
|
||||
#define debugf(level, ...) \
|
||||
do { \
|
||||
if(UNLIKELY(debug & level)) zlog_debug(__VA_ARGS__); \
|
||||
if (unlikely(debug & level)) \
|
||||
zlog_debug(__VA_ARGS__); \
|
||||
} while (0)
|
||||
|
||||
#endif /* NO_DEBUG */
|
||||
|
@ -439,6 +439,14 @@ _Static_assert(sizeof(_uint64_t) == 8 && sizeof(_int64_t) == 8,
|
||||
#pragma diag_suppress 167
|
||||
#endif /* __INTELISENSE__ */
|
||||
|
||||
#if defined(__GNUC__) && (__GNUC__ >= 3)
|
||||
#define likely(_x) __builtin_expect(!!(_x), 1)
|
||||
#define unlikely(_x) __builtin_expect(!!(_x), 0)
|
||||
#else
|
||||
#define likely(_x) !!(_x)
|
||||
#define unlikely(_x) !!(_x)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -1,13 +1,5 @@
|
||||
#include "log.h"
|
||||
|
||||
#if defined(__GNUC__) && (__GNUC__ >= 3)
|
||||
#define likely(_x) __builtin_expect(!!(_x), 1)
|
||||
#define unlikely(_x) __builtin_expect(!!(_x), 0)
|
||||
#else
|
||||
#define likely(_x) !!(_x)
|
||||
#define unlikely(_x) !!(_x)
|
||||
#endif
|
||||
|
||||
#define NHRP_DEBUG_COMMON (1 << 0)
|
||||
#define NHRP_DEBUG_KERNEL (1 << 1)
|
||||
#define NHRP_DEBUG_IF (1 << 2)
|
||||
|
Loading…
Reference in New Issue
Block a user