ev.h
static int ev_api_register_event(ev_context *ctx, int fd, int mask) {
    struct poll_api *p_api = ctx->api;
    p_api->fds[p_api->nfds].fd = fd;
    if (mask & EV_READ) p_api->fds[p_api->nfds].events |= POLLIN;
    if (mask & EV_WRITE) p_api->fds[p_api->nfds].events |= POLLOUT;
    p_api->nfds++;
    if (p_api->nfds >= p_api->events_monitored) {
        p_api->events_monitored *= 2;
        p_api->fds = realloc(p_api->fds,
                                 p_api->events_monitored * sizeof(struct pollfd));
    }
    return EV_OK;
}
/*
 * We have to check for resize even here just like ev_api_watch_fd.
 */
We have to check for resize even here just like ev_api_watch_fd.
We have to check for resize even here just like ev_api_watch_fd .
static int ev_api_register_event(ev_context *ctx, int fd, int mask) {
    struct poll_api *p_api = ctx->api;
    p_api->fds[p_api->nfds].fd = fd;
    if (mask & EV_READ) p_api->fds[p_api->nfds].events |= POLLIN;
    if (mask & EV_WRITE) p_api->fds[p_api->nfds].events |= POLLOUT;
    p_api->nfds++;
    if (p_api->nfds >= p_api->events_monitored) {
        p_api->events_monitored *= 2;
        p_api->fds = realloc(p_api->fds,
                                 p_api->events_monitored * sizeof(struct pollfd));
    }
    return EV_OK;
}
static int ev_api_register_event ( ev_context * ctx , int fd , int mask ) { struct poll_api * p_api = ctx -> api ; p_api -> fds [ p_api -> nfds ] . fd = fd ; if ( mask & EV_READ ) p_api -> fds [ p_api -> nfds ] . events |= POLLIN ; if ( mask & EV_WRITE ) p_api -> fds [ p_api -> nfds ] . events |= POLLOUT ; p_api -> nfds ++ ; if ( p_api -> nfds >= p_api -> events_monitored ) { p_api -> events_monitored *= 2 ; p_api -> fds = realloc ( p_api -> fds , p_api -> events_monitored * sizeof ( struct pollfd ) ) ; } return EV_OK ; }
We have to check for resize even here just like ev_api_watch_fd.
We have to check for resize even here just like ev_api_watch_fd .