MEDIUM: fd: remove the EV_FD_COND_* primitives
These primitives were initially introduced so that callers were able to
conditionally set/disable polling on a file descriptor and check in return
what the state was. It's been long since we last had an "if" on this, and
all pollers' functions were the same for cond_* and their systematic
counter parts, except that this required a check and a specific return
value that are not always necessary.
So let's simplify the FD API by removing this now unused distinction and
by making all specific functions return void.
diff --git a/src/ev_kqueue.c b/src/ev_kqueue.c
index 3d12e36..4bfbf1b 100644
--- a/src/ev_kqueue.c
+++ b/src/ev_kqueue.c
@@ -60,24 +60,22 @@
return FD_ISSET(fd, fd_evts[dir]);
}
-REGPRM2 static int __fd_set(const int fd, int dir)
+REGPRM2 static void __fd_set(const int fd, int dir)
{
/* if the value was set, do nothing */
if (FD_ISSET(fd, fd_evts[dir]))
- return 0;
+ return;
FD_SET(fd, fd_evts[dir]);
EV_SET(kev, fd, dir2filt[dir], EV_ADD, 0, 0, NULL);
kevent(kqueue_fd, kev, 1, NULL, 0, NULL);
- return 1;
}
-REGPRM2 static int __fd_clr(const int fd, int dir)
+REGPRM2 static void __fd_clr(const int fd, int dir)
{
if (!kqev_del(kev, fd, dir))
- return 0;
+ return;
kevent(kqueue_fd, kev, 1, NULL, 0, NULL);
- return 1;
}
REGPRM1 static void __fd_rem(int fd)
@@ -275,8 +273,8 @@
p->fork = _do_fork;
p->is_set = __fd_is_set;
- p->cond_s = p->set = __fd_set;
- p->cond_c = p->clr = __fd_clr;
+ p->set = __fd_set;
+ p->clr = __fd_clr;
p->rem = __fd_rem;
p->clo = __fd_clo;
}