--- libev/ev.c 2008/10/13 23:20:12 1.264 +++ libev/ev.c 2008/10/23 04:56:49 1.265 @@ -451,6 +451,8 @@ WL head; unsigned char events; unsigned char reify; + unsigned char emask; /* the epoll backend stores the actual kernel mask in here */ + unsigned char unused; /* currently unused padding */ #if EV_SELECT_IS_WINSOCKET SOCKET handle; #endif @@ -613,6 +615,9 @@ return ev_realloc (base, elem * *cur); } +#define array_init_zero(base,count) \ + memset ((void *)(base), 0, sizeof (*(base)) * (count)) + #define array_needsize(type,base,cur,cnt,init) \ if (expect_false ((cnt) > (cur))) \ { \ @@ -665,19 +670,6 @@ /*****************************************************************************/ -void inline_size -anfds_init (ANFD *base, int count) -{ - while (count--) - { - base->head = 0; - base->events = EV_NONE; - base->reify = 0; - - ++base; - } -} - void inline_speed fd_event (EV_P_ int fd, int revents) { @@ -977,18 +969,6 @@ static EV_ATOMIC_T gotsig; -void inline_size -signals_init (ANSIG *base, int count) -{ - while (count--) - { - base->head = 0; - base->gotsig = 0; - - ++base; - } -} - /*****************************************************************************/ void inline_speed @@ -2141,11 +2121,12 @@ return; assert (("ev_io_start called with negative fd", fd >= 0)); + assert (("ev_io start called with illegal event mask", !(w->events & ~(EV_IOFDSET | EV_READ | EV_WRITE)))); EV_FREQUENT_CHECK; ev_start (EV_A_ (W)w, 1); - array_needsize (ANFD, anfds, anfdmax, fd + 1, anfds_init); + array_needsize (ANFD, anfds, anfdmax, fd + 1, array_init_zero); wlist_add (&anfds[fd].head, (WL)w); fd_change (EV_A_ fd, w->events & EV_IOFDSET | 1); @@ -2347,7 +2328,7 @@ sigprocmask (SIG_SETMASK, &full, &prev); #endif - array_needsize (ANSIG, signals, signalmax, w->signum, signals_init); + array_needsize (ANSIG, signals, signalmax, w->signum, array_init_zero); #ifndef _WIN32 sigprocmask (SIG_SETMASK, &prev, 0);