From 7a56e9e47132054fa8c527e1f6f35b6b2450f3f2 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 15 Aug 2011 13:16:29 +0000 Subject: some code cleanup --- src/lib/eventloop.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'src/lib/eventloop.c') diff --git a/src/lib/eventloop.c b/src/lib/eventloop.c index 9c74f12d..d1e8cd44 100644 --- a/src/lib/eventloop.c +++ b/src/lib/eventloop.c @@ -580,18 +580,21 @@ gnunet_gtk_select (void *cls, GNUNET_NETWORK_fdset_zero (efds); for (i = 0; i < fd_counter; i++) { - int set[3]; + int set = 0; - if ((set[0] = (FD_ISSET (ml->cached_poll_array[i].fd, &aread) && - (0 != (ml->cached_poll_array[i].revents & (G_IO_IN | G_IO_HUP | G_IO_ERR)))))) + if ( (NULL != rfds) && + (set |= (FD_ISSET (ml->cached_poll_array[i].fd, &aread) && + (0 != (ml->cached_poll_array[i].revents & (G_IO_IN | G_IO_HUP | G_IO_ERR)))))) GNUNET_NETWORK_fdset_set_native (rfds, ml->cached_poll_array[i].fd); - if ((set[1] = (FD_ISSET (ml->cached_poll_array[i].fd, &awrite) && - (0 != (ml->cached_poll_array[i].revents & (G_IO_OUT | G_IO_ERR)))))) + if ( (NULL != wfds) && + (set |= (FD_ISSET (ml->cached_poll_array[i].fd, &awrite) && + (0 != (ml->cached_poll_array[i].revents & (G_IO_OUT | G_IO_ERR)))))) GNUNET_NETWORK_fdset_set_native (wfds, ml->cached_poll_array[i].fd); - if ((set[2] = (FD_ISSET (ml->cached_poll_array[i].fd, &aexcept) && - (0 != (ml->cached_poll_array[i].revents & G_IO_ERR))))) + if ( (NULL != efds) && + (set |= (FD_ISSET (ml->cached_poll_array[i].fd, &aexcept) && + (0 != (ml->cached_poll_array[i].revents & G_IO_ERR))))) GNUNET_NETWORK_fdset_set_native (efds, ml->cached_poll_array[i].fd); - if (set[0] || set[1] || set[2]) + if (set) result++; } #else -- cgit v1.2.3