From 725c0784184bf4cb7cb0c1f4d9f35954ffbe260d Mon Sep 17 00:00:00 2001 From: Marco S Hyman Date: Mon, 3 Nov 2003 20:27:49 +0000 Subject: replace magic number for min number of poll_data entries to allocate with a define --- lib/libpthread/uthread/uthread_select.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/libpthread/uthread/uthread_select.c b/lib/libpthread/uthread/uthread_select.c index 33620ffc254..b3a227b474e 100644 --- a/lib/libpthread/uthread/uthread_select.c +++ b/lib/libpthread/uthread/uthread_select.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uthread_select.c,v 1.8 2003/10/19 22:49:11 marc Exp $ */ +/* $OpenBSD: uthread_select.c,v 1.9 2003/11/03 20:27:48 marc Exp $ */ /* * Copyright (c) 1995-1998 John Birrell * All rights reserved. @@ -45,6 +45,11 @@ #include #include "pthread_private.h" +/* + * Minimum number of poll_data entries to allocate + */ +#define POLLDATA_MIN 128 + int select(int numfds, fd_set * readfds, fd_set * writefds, fd_set * exceptfds, struct timeval * timeout) @@ -102,7 +107,7 @@ select(int numfds, fd_set * readfds, fd_set * writefds, if ((curthread->poll_data.fds == NULL) || (curthread->poll_data.nfds < fd_count)) { data.fds = (struct pollfd *) realloc(curthread->poll_data.fds, - sizeof(struct pollfd) * MAX(128, fd_count)); + sizeof(struct pollfd) * MAX(POLLDATA_MIN, fd_count)); if (data.fds == NULL) { errno = ENOMEM; ret = -1; @@ -114,7 +119,7 @@ select(int numfds, fd_set * readfds, fd_set * writefds, * currently being polled. */ curthread->poll_data.fds = data.fds; - curthread->poll_data.nfds = MAX(128, fd_count); + curthread->poll_data.nfds = MAX(POLLDATA_MIN, fd_count); } } if (ret == 0) { -- cgit v1.2.3