diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2017-01-08 23:04:43 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2017-01-08 23:04:43 +0000 |
commit | 0252fc4e6f8fd0a837c4a0b9f5b8a6c8cf816563 (patch) | |
tree | 468beaf789927491639596972acada603206db30 /usr.sbin/dvmrpd | |
parent | b48830065830f0f1c32e799c66fb805c0d7aeb5c (diff) |
Replace hand-rolled for(;;) traversal of ctl_conns TAILQ with
TAILQ_FOREACH().
No intentional functional change.
ok reyk@
Diffstat (limited to 'usr.sbin/dvmrpd')
-rw-r--r-- | usr.sbin/dvmrpd/control.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/usr.sbin/dvmrpd/control.c b/usr.sbin/dvmrpd/control.c index c3ef8bdd749..6392a1a11a9 100644 --- a/usr.sbin/dvmrpd/control.c +++ b/usr.sbin/dvmrpd/control.c @@ -1,4 +1,4 @@ -/* $OpenBSD: control.c,v 1.22 2015/12/07 19:14:49 mmcc Exp $ */ +/* $OpenBSD: control.c,v 1.23 2017/01/08 23:04:42 krw Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -161,9 +161,10 @@ control_connbyfd(int fd) { struct ctl_conn *c; - for (c = TAILQ_FIRST(&ctl_conns); c != NULL && c->iev.ibuf.fd != fd; - c = TAILQ_NEXT(c, entry)) - ; /* nothing */ + TAILQ_FOREACH(c, &ctl_conns, entry) { + if (c->iev.ibuf.fd == fd) + break; + } return (c); } @@ -173,9 +174,10 @@ control_connbypid(pid_t pid) { struct ctl_conn *c; - for (c = TAILQ_FIRST(&ctl_conns); c != NULL && c->iev.ibuf.pid != pid; - c = TAILQ_NEXT(c, entry)) - ; /* nothing */ + TAILQ_FOREACH(c, &ctl_conns, entry) { + if (c->iev.ibuf.pid == pid) + break; + } return (c); } |