From 5dc2c40cf590d5239329b26c5e0f1fa2a19cd2db Mon Sep 17 00:00:00 2001 From: Nick Kew Date: Fri, 24 Aug 2018 21:13:34 +0000 Subject: Tidyup of ugly practice that stuck out in review of 1.6 changes. No functional change. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.6.x@1838963 13f79535-47bb-0310-9956-ffa450edef68 --- poll/unix/port.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/poll/unix/port.c b/poll/unix/port.c index c1e599412..94b6fa397 100644 --- a/poll/unix/port.c +++ b/poll/unix/port.c @@ -356,7 +356,7 @@ static apr_status_t impl_pollset_poll(apr_pollset_t *pollset, apr_os_sock_t fd; int ret; unsigned int nget, i; - apr_int32_t j; + apr_int32_t nres = 0; pfd_elem_t *ep; apr_status_t rv = APR_SUCCESS; @@ -406,7 +406,7 @@ static apr_status_t impl_pollset_poll(apr_pollset_t *pollset, pollset_lock_rings(); - for (i = 0, j = 0; i < nget; i++) { + for (i = 0; i < nget; i++) { ep = (pfd_elem_t *)pollset->p->port_set[i].portev_user; if ((pollset->flags & APR_POLLSET_WAKEABLE) && ep->pfd.desc_type == APR_POLL_FILE && @@ -415,10 +415,10 @@ static apr_status_t impl_pollset_poll(apr_pollset_t *pollset, rv = APR_EINTR; } else { - pollset->p->result_set[j] = ep->pfd; - pollset->p->result_set[j].rtnevents = + pollset->p->result_set[nres] = ep->pfd; + pollset->p->result_set[nres].rtnevents = get_revent(pollset->p->port_set[i].portev_events); - j++; + ++nres; } /* If the ring element is still on the query ring, move it * to the add ring for re-association with the event port @@ -432,7 +432,8 @@ static apr_status_t impl_pollset_poll(apr_pollset_t *pollset, pfd_elem_t, link); } } - if ((*num = j)) { /* any event besides wakeup pipe? */ + if (nres > 0) { /* any event besides wakeup pipe? */ + *num = nres; rv = APR_SUCCESS; if (descriptors) { *descriptors = pollset->p->result_set; -- cgit v1.2.1