X-Git-Url: https://git.llucax.com/software/libev.git/blobdiff_plain/4ebe9e295b974622f802229ca8e371ee6df9525a..b4ea51ffb8ad1cf82bc52c03035eb335e2b4c88c:/ev_kqueue.c?ds=inline diff --git a/ev_kqueue.c b/ev_kqueue.c index afd3f9c..3103db1 100644 --- a/ev_kqueue.c +++ b/ev_kqueue.c @@ -83,7 +83,7 @@ kqueue_poll (EV_P_ ev_tstamp timeout) if (kqueue_changecnt > kqueue_eventmax) { ev_free (kqueue_events); - kqueue_eventmax = array_roundsize (struct kevent, kqueue_changecnt); + kqueue_eventmax = array_nextsize (sizeof (struct kevent), kqueue_eventmax, kqueue_changecnt); kqueue_events = (struct kevent *)ev_malloc (sizeof (struct kevent) * kqueue_eventmax); } @@ -92,7 +92,7 @@ kqueue_poll (EV_P_ ev_tstamp timeout) res = kevent (backend_fd, kqueue_changes, kqueue_changecnt, kqueue_events, kqueue_eventmax, &ts); kqueue_changecnt = 0; - if (res < 0) + if (expect_false (res < 0)) { if (errno != EINTR) syserr ("(libev) kevent"); @@ -137,7 +137,7 @@ kqueue_poll (EV_P_ ev_tstamp timeout) if (expect_false (res == kqueue_eventmax)) { ev_free (kqueue_events); - kqueue_eventmax = array_roundsize (struct kevent, kqueue_eventmax << 1); + kqueue_eventmax = array_nextsize (sizeof (struct kevent), kqueue_eventmax, kqueue_eventmax + 1); kqueue_events = (struct kevent *)ev_malloc (sizeof (struct kevent) * kqueue_eventmax); } }