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_select.c b/src/ev_select.c
index c5d3936..cf45262 100644
--- a/src/ev_select.c
+++ b/src/ev_select.c
@@ -40,34 +40,14 @@
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)
{
FD_SET(fd, fd_evts[dir]);
- return 0;
}
-REGPRM2 static int __fd_clr(const int fd, int dir)
+REGPRM2 static void __fd_clr(const int fd, int dir)
{
FD_CLR(fd, fd_evts[dir]);
- return 0;
-}
-
-REGPRM2 static int __fd_cond_s(const int fd, int dir)
-{
- int ret;
- ret = !FD_ISSET(fd, fd_evts[dir]);
- if (ret)
- FD_SET(fd, fd_evts[dir]);
- return ret;
-}
-
-REGPRM2 static int __fd_cond_c(const int fd, int dir)
-{
- int ret;
- ret = FD_ISSET(fd, fd_evts[dir]);
- if (ret)
- FD_CLR(fd, fd_evts[dir]);
- return ret;
}
REGPRM1 static void __fd_rem(int fd)
@@ -249,8 +229,6 @@
p->set = __fd_set;
p->clr = __fd_clr;
p->clo = p->rem = __fd_rem;
- p->cond_s = __fd_cond_s;
- p->cond_c = __fd_cond_c;
}