diff options
-rw-r--r-- | source3/include/debug.h | 8 | ||||
-rw-r--r-- | source3/lib/talloc/talloc.c | 8 |
2 files changed, 16 insertions, 0 deletions
diff --git a/source3/include/debug.h b/source3/include/debug.h index d8dafcbd45..d1716320b3 100644 --- a/source3/include/debug.h +++ b/source3/include/debug.h @@ -169,12 +169,20 @@ extern bool *DEBUGLEVEL_CLASS_ISSET; #if (__GNUC__ >= 3) /* the strange !! is to ensure that __builtin_expect() takes either 0 or 1 as its first argument */ +#ifndef likely #define likely(x) __builtin_expect(!!(x), 1) +#endif +#ifndef unlikely #define unlikely(x) __builtin_expect(!!(x), 0) +#endif #else +#ifndef likely #define likely(x) (x) +#endif +#ifndef unlikely #define unlikely(x) (x) #endif +#endif #define CHECK_DEBUGLVL( level ) \ ( ((level) <= MAX_DEBUG_LEVEL) && \ diff --git a/source3/lib/talloc/talloc.c b/source3/lib/talloc/talloc.c index d535c3d784..99210f3e1b 100644 --- a/source3/lib/talloc/talloc.c +++ b/source3/lib/talloc/talloc.c @@ -82,12 +82,20 @@ #if (__GNUC__ >= 3) /* the strange !! is to ensure that __builtin_expect() takes either 0 or 1 as its first argument */ +#ifndef likely #define likely(x) __builtin_expect(!!(x), 1) +#endif +#ifndef unlikely #define unlikely(x) __builtin_expect(!!(x), 0) +#endif #else +#ifndef likely #define likely(x) (x) +#endif +#ifndef unlikely #define unlikely(x) (x) #endif +#endif /* this null_context is only used if talloc_enable_leak_report() or talloc_enable_leak_report_full() is called, otherwise it remains |