mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-29 07:58:01 -04: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;
|
return true;
|
||||||
|
|
||||||
tll_foreach(fdm->fds, it) {
|
tll_foreach(fdm->fds, it) {
|
||||||
if (it->item->fd == fd) {
|
if (it->item->fd != fd)
|
||||||
if (epoll_ctl(fdm->epoll_fd, EPOLL_CTL_DEL, fd, NULL) < 0)
|
continue;
|
||||||
LOG_ERRNO("failed to unregister FD=%d from epoll", fd);
|
|
||||||
|
|
||||||
if (close_fd)
|
if (epoll_ctl(fdm->epoll_fd, EPOLL_CTL_DEL, fd, NULL) < 0)
|
||||||
close(it->item->fd);
|
LOG_ERRNO("failed to unregister FD=%d from epoll", fd);
|
||||||
|
|
||||||
it->item->deleted = true;
|
if (close_fd)
|
||||||
if (fdm->is_polling)
|
close(it->item->fd);
|
||||||
tll_push_back(fdm->deferred_delete, it->item);
|
|
||||||
else
|
|
||||||
free(it->item);
|
|
||||||
|
|
||||||
tll_remove(fdm->fds, it);
|
it->item->deleted = true;
|
||||||
return 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);
|
LOG_ERR("no such FD: %d", fd);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue