MINOR: polling: create function fd_compute_new_polled_status()
This function is used to compute the new polling state based on
the previous state. All pollers have to do this in their update
loop, so better centralize the logic for it.
diff --git a/src/ev_kqueue.c b/src/ev_kqueue.c
index 0473adc..06ccaee 100644
--- a/src/ev_kqueue.c
+++ b/src/ev_kqueue.c
@@ -47,28 +47,14 @@
/* first, scan the update list to find changes */
for (updt_idx = 0; updt_idx < fd_nbupdt; updt_idx++) {
fd = fd_updt[updt_idx];
- en = eo = fdtab[fd].state;
-
fdtab[fd].updated = 0;
fdtab[fd].new = 0;
if (!fdtab[fd].owner)
continue;
- if (en & FD_EV_ACTIVE_R) {
- if (!(en & FD_EV_READY_R))
- en |= FD_EV_POLLED_R;
- }
- else
- en &= ~FD_EV_POLLED_R;
-
- if (en & FD_EV_ACTIVE_W) {
- if (!(en & FD_EV_READY_W))
- en |= FD_EV_POLLED_W;
- }
- else
- en &= ~FD_EV_POLLED_W;
-
+ eo = fdtab[fd].state;
+ en = fd_compute_new_polled_status(eo);
if ((eo ^ en) & FD_EV_POLLED_RW) {
/* poll status changed */