summaryrefslogtreecommitdiffstats
path: root/talloc.c
diff options
context:
space:
mode:
authorUoti Urpala <uau@glyph.nonexistent.invalid>2008-12-27 16:46:38 +0200
committerUoti Urpala <uau@glyph.nonexistent.invalid>2008-12-27 16:52:48 +0200
commita76f59b0390a408de0a666cb1edfc578b734596a (patch)
tree413af39ede01596852771bdb25659c8598b2bde1 /talloc.c
parent64b22229e339bef4a3bc9d2a42529da9073a0674 (diff)
downloadmpv-a76f59b0390a408de0a666cb1edfc578b734596a.tar.bz2
mpv-a76f59b0390a408de0a666cb1edfc578b734596a.tar.xz
talloc.c: Update to match current upstream ("likely" macro definitions)
Use the current macro definitions for likely/unlikely from Samba. The old version lacked parentheses around the non-GCC alternative, but there are no uses where this would actually make a difference.
Diffstat (limited to 'talloc.c')
-rw-r--r--talloc.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/talloc.c b/talloc.c
index 3509523dc6..63550cf4d4 100644
--- a/talloc.c
+++ b/talloc.c
@@ -108,11 +108,19 @@ static size_t rep_strnlen(const char *s, size_t max)
#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
-#define likely(x) x
-#define unlikely(x) x
+#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