diff options
author | 2019-11-29 16:39:23 +0000 | |
---|---|---|
committer | 2019-11-29 16:39:23 +0000 | |
commit | 2feeeaca77985b4b5f62e316217d0e0e9d80ccca (patch) | |
tree | 1f1f34a43162d4cd1bdba6d5c0b70bbf41fae9c3 | |
parent | whitespaces (diff) | |
download | wireguard-openbsd-2feeeaca77985b4b5f62e316217d0e0e9d80ccca.tar.xz wireguard-openbsd-2feeeaca77985b4b5f62e316217d0e0e9d80ccca.zip |
Don't hand-roll TAILQ_CONCAT in a slow way.
Pointed out by & OK otto
-rw-r--r-- | sbin/unwind/unwind.c | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/sbin/unwind/unwind.c b/sbin/unwind/unwind.c index 80b917ce72f..763df3385ad 100644 --- a/sbin/unwind/unwind.c +++ b/sbin/unwind/unwind.c @@ -1,4 +1,4 @@ -/* $OpenBSD: unwind.c,v 1.41 2019/11/27 17:11:00 florian Exp $ */ +/* $OpenBSD: unwind.c,v 1.42 2019/11/29 16:39:23 florian Exp $ */ /* * Copyright (c) 2018 Florian Obser <florian@openbsd.org> @@ -647,19 +647,10 @@ merge_config(struct uw_conf *conf, struct uw_conf *xconf) conf->blocklist_log = xconf->blocklist_log; /* Add new forwarders. */ - while ((uw_forwarder = TAILQ_FIRST(&xconf->uw_forwarder_list)) != - NULL) { - TAILQ_REMOVE(&xconf->uw_forwarder_list, uw_forwarder, entry); - TAILQ_INSERT_TAIL(&conf->uw_forwarder_list, - uw_forwarder, entry); - } - while ((uw_forwarder = TAILQ_FIRST(&xconf->uw_dot_forwarder_list)) != - NULL) { - TAILQ_REMOVE(&xconf->uw_dot_forwarder_list, uw_forwarder, - entry); - TAILQ_INSERT_TAIL(&conf->uw_dot_forwarder_list, - uw_forwarder, entry); - } + TAILQ_CONCAT(&conf->uw_forwarder_list, &xconf->uw_forwarder_list, + entry); + TAILQ_CONCAT(&conf->uw_dot_forwarder_list, + &xconf->uw_dot_forwarder_list, entry); free(xconf); } |