diff options
author | krw <krw@openbsd.org> | 2017-01-08 23:04:42 +0000 |
---|---|---|
committer | krw <krw@openbsd.org> | 2017-01-08 23:04:42 +0000 |
commit | c39b72087802b3201e2c1e559c2535a94f4b0249 (patch) | |
tree | dd58464e2e2c43ee1473bccc864fcb3a25d64714 /usr.sbin/ldpd | |
parent | Indentation must be measured in units of the surrounding text, (diff) | |
download | wireguard-openbsd-c39b72087802b3201e2c1e559c2535a94f4b0249.tar.xz wireguard-openbsd-c39b72087802b3201e2c1e559c2535a94f4b0249.zip |
Replace hand-rolled for(;;) traversal of ctl_conns TAILQ with
TAILQ_FOREACH().
No intentional functional change.
ok reyk@
Diffstat (limited to 'usr.sbin/ldpd')
-rw-r--r-- | usr.sbin/ldpd/control.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/usr.sbin/ldpd/control.c b/usr.sbin/ldpd/control.c index 4ac6b114b27..b6a209912e7 100644 --- a/usr.sbin/ldpd/control.c +++ b/usr.sbin/ldpd/control.c @@ -1,4 +1,4 @@ -/* $OpenBSD: control.c,v 1.27 2016/05/23 19:20:55 renato Exp $ */ +/* $OpenBSD: control.c,v 1.28 2017/01/08 23:04:42 krw Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -150,9 +150,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); } @@ -162,9 +163,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); } |