summaryrefslogtreecommitdiffstats
path: root/compat
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2019-03-04 00:04:21 +0000
committerRoy Marples <roy@marples.name>2019-03-04 00:04:21 +0000
commitb41110ab5bfc91d305896c3e60461bdfb7660fd9 (patch)
tree09e33c9c2e7054f53196e609775ffb9683fff350 /compat
parent4828cdf228508fa725bef63da439eaf9be4eafba (diff)
downloaddhcpcd-b41110ab5bfc91d305896c3e60461bdfb7660fd9.tar.xz
OpenBSD: Fix crash with rbtree
Diffstat (limited to 'compat')
-rw-r--r--compat/rb.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/compat/rb.c b/compat/rb.c
index b7ced767..2e09af58 100644
--- a/compat/rb.c
+++ b/compat/rb.c
@@ -67,7 +67,15 @@ __weak_alias(rb_tree_depths, _rb_tree_depths)
//#include <sys/rbtree.h>
//#endif
-#define __predict_false(tst) (tst)
+#if !defined(__predict_false)
+#if __GNUC_PREREQ__(2, 96) || defined(__lint__))
+#define __predict_true(exp) __builtin_expect((exp) != 0, 1)
+#define __predict_false(exp) __builtin_expect((exp) != 0, 0)
+#else
+#define __predict_true(exp) (exp)
+#define __predict_false(exp) (exp)
+#endif
+#endif
static void rb_tree_insert_rebalance(struct rb_tree *, struct rb_node *);
static void rb_tree_removal_rebalance(struct rb_tree *, struct rb_node *,