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_sepoll.c b/src/ev_sepoll.c
index 5d93bf2..62ee115 100644
--- a/src/ev_sepoll.c
+++ b/src/ev_sepoll.c
@@ -215,7 +215,7 @@
* Don't worry about the strange constructs in __fd_set/__fd_clr, they are
* designed like this in order to reduce the number of jumps (verified).
*/
-REGPRM2 static int __fd_set(const int fd, int dir)
+REGPRM2 static void __fd_set(const int fd, int dir)
{
unsigned int i;
@@ -229,15 +229,14 @@
if (i != FD_EV_STOP) {
if (unlikely(i != FD_EV_IDLE))
- return 0;
+ return;
// switch to SPEC state and allocate a SPEC entry.
alloc_spec_entry(fd);
}
fdtab[fd].spec.e ^= (unsigned int)(FD_EV_IN_SL << dir);
- return 1;
}
-REGPRM2 static int __fd_clr(const int fd, int dir)
+REGPRM2 static void __fd_clr(const int fd, int dir)
{
unsigned int i;
@@ -251,7 +250,7 @@
if (i != FD_EV_SPEC) {
if (unlikely(i != FD_EV_WAIT))
- return 0;
+ return;
// switch to STOP state
/* We will create a queue entry for this one because we want to
* process it later in order to merge it with other events on
@@ -260,7 +259,6 @@
alloc_spec_entry(fd);
}
fdtab[fd].spec.e ^= (unsigned int)(FD_EV_IN_SL << dir);
- return 1;
}
/* normally unused */
@@ -593,8 +591,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;
}