about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorFlorian Westphal <fw@strlen.de>2012-01-24 22:24:47 +0100
committerFlorian Westphal <fw@strlen.de>2012-01-24 22:25:22 +0100
commit44bb22d23ec6841457db41732caa6f5f9129b615 (patch)
treefb6655110156ef24190fd297c3d1343eeda24ddd /src
parentc7dd5ea0baeff589a569cdc7ffd46fc83e885ab2 (diff)
downloadngircd-44bb22d23ec6841457db41732caa6f5f9129b615.tar.gz
ngircd-44bb22d23ec6841457db41732caa6f5f9129b615.zip
io: use define for number of possible events
Diffstat (limited to 'src')
-rw-r--r--src/ngircd/io.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/ngircd/io.c b/src/ngircd/io.c
index f061ce05..9ffdfd6b 100644
--- a/src/ngircd/io.c
+++ b/src/ngircd/io.c
@@ -41,6 +41,7 @@ typedef struct {
 
 #define INIT_IOEVENT		{ NULL, -1, 0, NULL }
 #define IO_ERROR		4
+#define MAX_EVENTS		100
 
 #ifdef HAVE_EPOLL_CREATE
 #  define IO_USE_EPOLL		1
@@ -162,13 +163,13 @@ io_dispatch_devpoll(struct timeval *tv)
 	time_t sec = tv->tv_sec * 1000;
 	int i, ret, timeout = tv->tv_usec + sec;
 	short what;
-	struct pollfd p[100];
+	struct pollfd p[MAX_EVENTS];
 
 	if (timeout < 0)
 		timeout = 1000;
 
 	dvp.dp_timeout = timeout;
-	dvp.dp_nfds = 100;
+	dvp.dp_nfds = MAX_EVENTS;
 	dvp.dp_fds = p;
 	ret = ioctl(io_masterfd, DP_POLL, &dvp);
 
@@ -458,13 +459,13 @@ io_dispatch_epoll(struct timeval *tv)
 {
 	time_t sec = tv->tv_sec * 1000;
 	int i, ret, timeout = tv->tv_usec + sec;
-	struct epoll_event epoll_ev[100];
+	struct epoll_event epoll_ev[MAX_EVENTS];
 	short type;
 
 	if (timeout < 0)
 		timeout = 1000;
 
-	ret = epoll_wait(io_masterfd, epoll_ev, 100, timeout);
+	ret = epoll_wait(io_masterfd, epoll_ev, MAX_EVENTS, timeout);
 
 	for (i = 0; i < ret; i++) {
 		type = 0;
@@ -565,7 +566,7 @@ static int
 io_dispatch_kqueue(struct timeval *tv)
 {
 	int i, ret;
-	struct kevent kev[100];
+	struct kevent kev[MAX_EVENTS];
 	struct kevent *newevents;
 	struct timespec ts;
 	int newevents_len;
@@ -576,7 +577,7 @@ io_dispatch_kqueue(struct timeval *tv)
 	newevents = (newevents_len > 0) ? array_start(&io_evcache) : NULL;
 	assert(newevents_len >= 0);
 
-	ret = kevent(io_masterfd, newevents, newevents_len, kev, 100, &ts);
+	ret = kevent(io_masterfd, newevents, newevents_len, kev, MAX_EVENTS, &ts);
 	if (newevents && ret != -1)
 		array_trunc(&io_evcache);