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>
This commit is contained in:
Renato Westphal 2017-03-03 17:50:22 -03:00
parent bc6cec21c4
commit b53f7b86ef

View File

@ -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);
}