summaryrefslogtreecommitdiffstats
path: root/usr.sbin/dvmrpd
diff options
context:
space:
mode:
authorkrw <krw@openbsd.org>2017-01-05 12:42:18 +0000
committerkrw <krw@openbsd.org>2017-01-05 12:42:18 +0000
commit54c95b7a05c13730c666209dd1d5d4b9646ab36a (patch)
treee723dbe9a6b55d44a1548c69104270c0c8a8fcd3 /usr.sbin/dvmrpd
parentRemove some unnecessary code abstractions and while here remove a (diff)
downloadwireguard-openbsd-54c95b7a05c13730c666209dd1d5d4b9646ab36a.tar.xz
wireguard-openbsd-54c95b7a05c13730c666209dd1d5d4b9646ab36a.zip
Replace symset()'s hand-rolled for(;;) traversal of 'symhead' TAILQ
with more modern TAILQ_FOREACH(). This what symget() was already doing. Add paranoia '{}' around body of symget()'s TAILQ_FOREACH(). No intentional functional change. ok bluhm@ otto@
Diffstat (limited to 'usr.sbin/dvmrpd')
-rw-r--r--usr.sbin/dvmrpd/parse.y12
1 files changed, 7 insertions, 5 deletions
diff --git a/usr.sbin/dvmrpd/parse.y b/usr.sbin/dvmrpd/parse.y
index e78843fec8f..023c89dfc53 100644
--- a/usr.sbin/dvmrpd/parse.y
+++ b/usr.sbin/dvmrpd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.30 2016/06/21 21:35:24 benno Exp $ */
+/* $OpenBSD: parse.y,v 1.31 2017/01/05 12:42:18 krw Exp $ */
/*
* Copyright (c) 2004, 2005, 2006 Esben Norby <norby@openbsd.org>
@@ -793,9 +793,10 @@ symset(const char *nam, const char *val, int persist)
{
struct sym *sym;
- for (sym = TAILQ_FIRST(&symhead); sym && strcmp(nam, sym->nam);
- sym = TAILQ_NEXT(sym, entry))
- ; /* nothing */
+ TAILQ_FOREACH(sym, &symhead, entry) {
+ if (strcmp(nam, sym->nam) == 0)
+ break;
+ }
if (sym != NULL) {
if (sym->persist == 1)
@@ -854,11 +855,12 @@ symget(const char *nam)
{
struct sym *sym;
- TAILQ_FOREACH(sym, &symhead, entry)
+ TAILQ_FOREACH(sym, &symhead, entry) {
if (strcmp(nam, sym->nam) == 0) {
sym->used = 1;
return (sym->val);
}
+ }
return (NULL);
}