Grow pollfds array exponentially.

This commit is contained in:
Simon Kelley
2015-07-13 12:47:52 +01:00
parent c895a0626d
commit 90c3822bfa

View File

@@ -102,8 +102,9 @@ void poll_listen(int fd, short event)
{ {
/* Array too small, extend. */ /* Array too small, extend. */
struct pollfd *new; struct pollfd *new;
arrsize += 64;
arrsize = (arrsize == 0) ? 64 : arrsize * 2;
if (!(new = whine_malloc(arrsize * sizeof(struct pollfd)))) if (!(new = whine_malloc(arrsize * sizeof(struct pollfd))))
return; return;