]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Support NetBSD-6, 7 and 8.
authorRoy Marples <roy@marples.name>
Mon, 4 Mar 2019 00:22:23 +0000 (00:22 +0000)
committerRoy Marples <roy@marples.name>
Mon, 4 Mar 2019 00:22:23 +0000 (00:22 +0000)
src/route.c

index b570168de8cf415e467b0bdd7defc5906db97e89..480215ccef8aadcd9a758a25346ce949ddfa02bf 100644 (file)
 #include "route.h"
 #include "sa.h"
 
+/* Needed for NetBSD-6, 7 and 8. */
+#ifndef RB_TREE_FOREACH_SAFE
+#ifndef RB_TREE_PREV
+#define RB_TREE_NEXT(T, N) rb_tree_iterate((T), (N), RB_DIR_RIGHT)
+#define RB_TREE_PREV(T, N) rb_tree_iterate((T), (N), RB_DIR_LEFT)
+#endif
+#define RB_TREE_FOREACH_SAFE(N, T, S) \
+    for ((N) = RB_TREE_MIN(T); \
+        (N) && ((S) = RB_TREE_NEXT((T), (N)), 1); \
+        (N) = (S))
+#define RB_TREE_FOREACH_REVERSE_SAFE(N, T, S) \
+    for ((N) = RB_TREE_MAX(T); \
+        (N) && ((S) = RB_TREE_PREV((T), (N)), 1); \
+        (N) = (S))
+#endif
+
 static int
 rt_compare(__unused void *context, const void *node1, const void *node2)
 {