diff options
author | Renato Westphal <renato@opensourcerouting.org> | 2017-03-03 21:50:22 +0100 |
---|---|---|
committer | Renato Westphal <renato@opensourcerouting.org> | 2017-03-03 21:50:22 +0100 |
commit | b53f7b86efe5fdd6692fc9033e032881c4357139 (patch) | |
tree | cf9bedf57537224f3015dc7ddc009245ebd8266b /ldpd/control.c | |
parent | Merge pull request #245 from donaldsharp/ldpd_load (diff) | |
download | frr-b53f7b86efe5fdd6692fc9033e032881c4357139.tar.xz frr-b53f7b86efe5fdd6692fc9033e032881c4357139.zip |
ldpd: replace hand-rolled 'for' loop with specialized macro
No intentional functional change.
Original author: Kenneth R Westerback <krw@openbsd.org>
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to '')
-rw-r--r-- | ldpd/control.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/ldpd/control.c b/ldpd/control.c index 8a2280be0..0bfe0abc9 100644 --- a/ldpd/control.c +++ b/ldpd/control.c @@ -148,9 +148,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); } @@ -160,9 +161,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); } |