From: Francesco Chemolli Date: Fri, 6 Jul 2012 10:18:43 +0000 (+0200) Subject: Improved readability in some prefix increment/decrement operators. X-Git-Tag: sourceformat-review-1~164^2~16 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=098346fd80ed491667bd0a581d97dcf9aa413ce8;p=thirdparty%2Fsquid.git Improved readability in some prefix increment/decrement operators. --- diff --git a/src/comm/AcceptLimiter.cc b/src/comm/AcceptLimiter.cc index 97da1c8a26..bb5b115ecb 100644 --- a/src/comm/AcceptLimiter.cc +++ b/src/comm/AcceptLimiter.cc @@ -14,7 +14,7 @@ Comm::AcceptLimiter &Comm::AcceptLimiter::Instance() void Comm::AcceptLimiter::defer(Comm::TcpAcceptor *afd) { - ++afd->isLimited; + ++ afd->isLimited; debugs(5, 5, HERE << afd->conn << " x" << afd->isLimited); deferred.push_back(afd); } @@ -24,7 +24,7 @@ Comm::AcceptLimiter::removeDead(const Comm::TcpAcceptor *afd) { for (unsigned int i = 0; i < deferred.size() && afd->isLimited > 0; ++i) { if (deferred[i] == afd) { - deferred[i]->isLimited--; + -- deferred[i]->isLimited; deferred[i] = NULL; // fast. kick() will skip empty entries later. debugs(5, 5, HERE << afd->conn << " x" << afd->isLimited); } @@ -44,7 +44,7 @@ Comm::AcceptLimiter::kick() TcpAcceptor *temp = deferred.shift(); if (temp != NULL) { debugs(5, 5, HERE << " doing one."); - temp->isLimited--; + -- temp->isLimited; temp->acceptNext(); break; } diff --git a/src/comm/ModDevPoll.cc b/src/comm/ModDevPoll.cc index 50b4f435a9..cdaed4fc42 100644 --- a/src/comm/ModDevPoll.cc +++ b/src/comm/ModDevPoll.cc @@ -165,7 +165,7 @@ comm_update_fd(int fd, int events) comm_flush_updates(); /* Push new event onto array */ - ++devpoll_update.cur; + ++ devpoll_update.cur; devpoll_update.pfds[devpoll_update.cur].fd = fd; devpoll_update.pfds[devpoll_update.cur].events = events; devpoll_update.pfds[devpoll_update.cur].revents = 0; @@ -361,7 +361,7 @@ Comm::DoSelect(int msec) comm_flush_updates(); /* ensure latest changes are sent to /dev/poll */ num = ioctl(devpoll_fd, DP_POLL, &do_poll); - ++statCounter.select_loops; + ++ statCounter.select_loops; if (num >= 0) break; /* no error, skip out of loop */ @@ -421,7 +421,7 @@ Comm::DoSelect(int msec) F->read_handler = NULL; hdl(fd, F->read_data); PROF_stop(comm_read_handler); - ++statCounter.select_fds; + ++ statCounter.select_fds; } else { debugs( 5, @@ -445,7 +445,7 @@ Comm::DoSelect(int msec) F->write_handler = NULL; hdl(fd, F->write_data); PROF_stop(comm_write_handler); - ++statCounter.select_fds; + ++ statCounter.select_fds; } else { debugs( 5, diff --git a/src/comm/ModEpoll.cc b/src/comm/ModEpoll.cc index 9a559fbcc5..1216f87dd9 100644 --- a/src/comm/ModEpoll.cc +++ b/src/comm/ModEpoll.cc @@ -258,7 +258,7 @@ Comm::DoSelect(int msec) for (;;) { num = epoll_wait(kdpfd, pevents, SQUID_MAXFD, msec); - ++statCounter.select_loops; + ++ statCounter.select_loops; if (num >= 0) break; @@ -300,7 +300,7 @@ Comm::DoSelect(int msec) F->read_handler = NULL; hdl(fd, F->read_data); PROF_stop(comm_write_handler); - ++statCounter.select_fds; + ++ statCounter.select_fds; } else { debugs(5, DEBUG_EPOLL ? 0 : 8, HERE << "no read handler for FD " << fd); // remove interest since no handler exist for this event. @@ -315,7 +315,7 @@ Comm::DoSelect(int msec) F->write_handler = NULL; hdl(fd, F->write_data); PROF_stop(comm_read_handler); - ++statCounter.select_fds; + ++ statCounter.select_fds; } else { debugs(5, DEBUG_EPOLL ? 0 : 8, HERE << "no write handler for FD " << fd); // remove interest since no handler exist for this event. diff --git a/src/comm/ModPoll.cc b/src/comm/ModPoll.cc index 7f1171e70d..c2b94c076b 100644 --- a/src/comm/ModPoll.cc +++ b/src/comm/ModPoll.cc @@ -216,7 +216,7 @@ comm_check_incoming_poll_handlers(int nfds, int *fds) PROF_start(comm_check_incoming); incoming_sockets_accepted = 0; - for (i = npfds = 0; i < nfds; i++) { + for (i = npfds = 0; i < nfds; ++i) { int events; fd = fds[i]; events = 0; @@ -241,7 +241,7 @@ comm_check_incoming_poll_handlers(int nfds, int *fds) } getCurrentTime(); - ++statCounter.syscalls.selects; + ++ statCounter.syscalls.selects; if (poll(pfds, npfds, 0) < 1) { PROF_stop(comm_check_incoming); @@ -283,11 +283,15 @@ comm_poll_udp_incoming(void) int nevents; udp_io_events = 0; - if (Comm::IsConnOpen(icpIncomingConn)) - fds[nfds++] = icpIncomingConn->fd; + if (Comm::IsConnOpen(icpIncomingConn)) { + fds[nfds] = icpIncomingConn->fd; + ++nfds; + } - if (icpIncomingConn != icpOutgoingConn && Comm::IsConnOpen(icpOutgoingConn)) - fds[nfds++] = icpOutgoingConn->fd; + if (icpIncomingConn != icpOutgoingConn && Comm::IsConnOpen(icpOutgoingConn)) { + fds[nfds] = icpOutgoingConn->fd; + ++nfds; + } if (nfds == 0) return; @@ -319,11 +323,12 @@ comm_poll_tcp_incoming(void) // XXX: only poll sockets that won't be deferred. But how do we identify them? - for (j = 0; j < NHttpSockets; j++) { + for (j = 0; j < NHttpSockets; ++j) { if (HttpSockets[j] < 0) continue; - fds[nfds++] = HttpSockets[j]; + fds[nfds] = HttpSockets[j]; + ++nfds; } nevents = comm_check_incoming_poll_handlers(nfds, fds); @@ -381,7 +386,7 @@ Comm::DoSelect(int msec) maxfd = Biggest_FD + 1; - for (int i = 0; i < maxfd; i++) { + for (int i = 0; i < maxfd; ++i) { int events; events = 0; /* Check each open socket for a handler. */ @@ -425,9 +430,9 @@ Comm::DoSelect(int msec) for (;;) { PROF_start(comm_poll_normal); - ++statCounter.syscalls.selects; + ++ statCounter.syscalls.selects; num = poll(pfds, nfds, msec); - ++statCounter.select_loops; + ++ statCounter.select_loops; PROF_stop(comm_poll_normal); if (num >= 0 || npending > 0) @@ -458,7 +463,7 @@ Comm::DoSelect(int msec) * limit in SunOS */ PROF_start(comm_handle_ready_fd); - for (size_t loopIndex = 0; loopIndex < nfds; loopIndex++) { + for (size_t loopIndex = 0; loopIndex < nfds; ++loopIndex) { fde *F; int revents = pfds[loopIndex].revents; fd = pfds[loopIndex].fd; @@ -498,7 +503,7 @@ Comm::DoSelect(int msec) F->flags.read_pending = 0; hdl(fd, F->read_data); PROF_stop(comm_read_handler); - ++statCounter.select_fds; + ++ statCounter.select_fds; if (commCheckUdpIncoming) comm_poll_udp_incoming(); @@ -519,7 +524,7 @@ Comm::DoSelect(int msec) F->write_handler = NULL; hdl(fd, F->write_data); PROF_stop(comm_write_handler); - ++statCounter.select_fds; + ++ statCounter.select_fds; if (commCheckUdpIncoming) comm_poll_udp_incoming(); @@ -595,11 +600,15 @@ comm_poll_dns_incoming(void) if (DnsSocketA < 0 && DnsSocketB < 0) return; - if (DnsSocketA >= 0) - fds[nfds++] = DnsSocketA; + if (DnsSocketA >= 0) { + fds[nfds] = DnsSocketA; + ++nfds; + } - if (DnsSocketB >= 0) - fds[nfds++] = DnsSocketB; + if (DnsSocketB >= 0) { + fds[nfds] = DnsSocketB; + ++nfds; + } nevents = comm_check_incoming_poll_handlers(nfds, fds);