]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Improved readability in some prefix increment/decrement operators.
authorFrancesco Chemolli <kinkie@squid-cache.org>
Fri, 6 Jul 2012 10:18:43 +0000 (12:18 +0200)
committerFrancesco Chemolli <kinkie@squid-cache.org>
Fri, 6 Jul 2012 10:18:43 +0000 (12:18 +0200)
src/comm/AcceptLimiter.cc
src/comm/ModDevPoll.cc
src/comm/ModEpoll.cc
src/comm/ModPoll.cc

index 97da1c8a2692a15fbcc55b94d4118535f09407b0..bb5b115ecb860f434dcc871cde433de37dff3c32 100644 (file)
@@ -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;
         }
index 50b4f435a9a9d89a6df9b147fe52d1e866c04a28..cdaed4fc42e170af73d02e5fe7e0a05d3c423c22 100644 (file)
@@ -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,
index 9a559fbcc5ff800f936d0a9baafb2e6d594120b0..1216f87dd911fb4d1a3b051e971eb51d8ee7c39e 100644 (file)
@@ -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.
index 7f1171e70da70dc5ad5028736fe58b60ed3e8944..c2b94c076b49e9b780a22a891bce79fd8ca83ce8 100644 (file)
@@ -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);