summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sbin/unwind/frontend.c5
-rw-r--r--sbin/unwind/parse.y6
-rw-r--r--sbin/unwind/unwind.c8
3 files changed, 7 insertions, 12 deletions
diff --git a/sbin/unwind/frontend.c b/sbin/unwind/frontend.c
index a07e71a1572..8adbb07219b 100644
--- a/sbin/unwind/frontend.c
+++ b/sbin/unwind/frontend.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: frontend.c,v 1.55 2020/11/09 04:20:46 tb Exp $ */
+/* $OpenBSD: frontend.c,v 1.56 2020/11/09 04:22:05 tb Exp $ */
/*
* Copyright (c) 2018 Florian Obser <florian@openbsd.org>
@@ -1195,8 +1195,7 @@ free_bl(void)
{
struct bl_node *n, *nxt;
- for (n = RB_MIN(bl_tree, &bl_head); n != NULL; n = nxt) {
- nxt = RB_NEXT(bl_tree, &bl_head, n);
+ RB_FOREACH_SAFE(n, bl_tree, &bl_head, nxt) {
RB_REMOVE(bl_tree, &bl_head, n);
free(n->domain);
free(n);
diff --git a/sbin/unwind/parse.y b/sbin/unwind/parse.y
index f99a3caf1e1..84c5fc6d40a 100644
--- a/sbin/unwind/parse.y
+++ b/sbin/unwind/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.23 2020/11/09 04:20:46 tb Exp $ */
+/* $OpenBSD: parse.y,v 1.24 2020/11/09 04:22:05 tb Exp $ */
/*
* Copyright (c) 2018 Florian Obser <florian@openbsd.org>
@@ -321,9 +321,7 @@ force : FORCE acceptbogus prefopt '{' force_list optnl '}' {
struct force_tree_entry *n, *nxt;
int error = 0;
- for (n = RB_MIN(force_tree, &$5); n != NULL;
- n = nxt) {
- nxt = RB_NEXT(force_tree, &conf->force, n);
+ RB_FOREACH_SAFE(n, force_tree, &$5, nxt) {
n->acceptbogus = $2;
n->type = $3;
RB_REMOVE(force_tree, &$5, n);
diff --git a/sbin/unwind/unwind.c b/sbin/unwind/unwind.c
index 3fa4dfc245b..cde7c2d0dc8 100644
--- a/sbin/unwind/unwind.c
+++ b/sbin/unwind/unwind.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: unwind.c,v 1.51 2020/11/09 04:20:46 tb Exp $ */
+/* $OpenBSD: unwind.c,v 1.52 2020/11/09 04:22:05 tb Exp $ */
/*
* Copyright (c) 2018 Florian Obser <florian@openbsd.org>
@@ -653,8 +653,7 @@ merge_config(struct uw_conf *conf, struct uw_conf *xconf)
}
/* Remove & discard existing force tree. */
- for (n = RB_MIN(force_tree, &conf->force); n != NULL; n = nxt) {
- nxt = RB_NEXT(force_tree, &conf->force, n);
+ RB_FOREACH_SAFE(n, force_tree, &conf->force, nxt) {
RB_REMOVE(force_tree, &conf->force, n);
free(n);
}
@@ -672,8 +671,7 @@ merge_config(struct uw_conf *conf, struct uw_conf *xconf)
TAILQ_CONCAT(&conf->uw_dot_forwarder_list,
&xconf->uw_dot_forwarder_list, entry);
- for (n = RB_MIN(force_tree, &xconf->force); n != NULL; n = nxt) {
- nxt = RB_NEXT(force_tree, &xconf->force, n);
+ RB_FOREACH_SAFE(n, force_tree, &xconf->force, nxt) {
RB_REMOVE(force_tree, &xconf->force, n);
RB_INSERT(force_tree, &conf->force, n);
}