mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-10 04:27:45 -05:00
fdm: invert check to get rid of one level of indentation
This commit is contained in:
parent
9f1525aef7
commit
777d851282
1 changed files with 14 additions and 13 deletions
27
fdm.c
27
fdm.c
|
|
@ -109,22 +109,23 @@ fdm_del_internal(struct fdm *fdm, int fd, bool close_fd)
|
|||
return true;
|
||||
|
||||
tll_foreach(fdm->fds, it) {
|
||||
if (it->item->fd == fd) {
|
||||
if (epoll_ctl(fdm->epoll_fd, EPOLL_CTL_DEL, fd, NULL) < 0)
|
||||
LOG_ERRNO("failed to unregister FD=%d from epoll", fd);
|
||||
if (it->item->fd != fd)
|
||||
continue;
|
||||
|
||||
if (close_fd)
|
||||
close(it->item->fd);
|
||||
if (epoll_ctl(fdm->epoll_fd, EPOLL_CTL_DEL, fd, NULL) < 0)
|
||||
LOG_ERRNO("failed to unregister FD=%d from epoll", fd);
|
||||
|
||||
it->item->deleted = true;
|
||||
if (fdm->is_polling)
|
||||
tll_push_back(fdm->deferred_delete, it->item);
|
||||
else
|
||||
free(it->item);
|
||||
if (close_fd)
|
||||
close(it->item->fd);
|
||||
|
||||
tll_remove(fdm->fds, it);
|
||||
return true;
|
||||
}
|
||||
it->item->deleted = true;
|
||||
if (fdm->is_polling)
|
||||
tll_push_back(fdm->deferred_delete, it->item);
|
||||
else
|
||||
free(it->item);
|
||||
|
||||
tll_remove(fdm->fds, it);
|
||||
return true;
|
||||
}
|
||||
|
||||
LOG_ERR("no such FD: %d", fd);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue