From: Francesco Chemolli Date: Mon, 2 Jul 2012 12:37:13 +0000 (+0200) Subject: Change increment and decrement operators from postfix to prefix form. X-Git-Tag: sourceformat-review-1~199 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=cbebe6020e1055ad03c73b7fb8784f0f7a0a2cf4;p=thirdparty%2Fsquid.git Change increment and decrement operators from postfix to prefix form. --- diff --git a/src/comm/AcceptLimiter.cc b/src/comm/AcceptLimiter.cc index 5d3eb66e76..97da1c8a26 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); } @@ -22,7 +22,7 @@ Comm::AcceptLimiter::defer(Comm::TcpAcceptor *afd) void Comm::AcceptLimiter::removeDead(const Comm::TcpAcceptor *afd) { - for (unsigned int i = 0; i < deferred.size() && afd->isLimited > 0; i++) { + for (unsigned int i = 0; i < deferred.size() && afd->isLimited > 0; ++i) { if (deferred[i] == afd) { deferred[i]->isLimited--; deferred[i] = NULL; // fast. kick() will skip empty entries later. diff --git a/src/comm/IoCallback.cc b/src/comm/IoCallback.cc index 4793e6a752..66e985f396 100644 --- a/src/comm/IoCallback.cc +++ b/src/comm/IoCallback.cc @@ -14,7 +14,7 @@ Comm::CallbackTableInit() { // XXX: convert this to a std::map<> ? iocb_table = static_cast(xcalloc(Squid_MaxFD, sizeof(CbEntry))); - for (int pos = 0; pos < Squid_MaxFD; pos++) { + for (int pos = 0; pos < Squid_MaxFD; ++pos) { iocb_table[pos].fd = pos; iocb_table[pos].readcb.type = IOCB_READ; iocb_table[pos].writecb.type = IOCB_WRITE; @@ -25,7 +25,7 @@ void Comm::CallbackTableDestruct() { // release any Comm::Connections being held. - for (int pos = 0; pos < Squid_MaxFD; pos++) { + for (int pos = 0; pos < Squid_MaxFD; ++pos) { iocb_table[pos].readcb.conn = NULL; iocb_table[pos].writecb.conn = NULL; } diff --git a/src/comm/ModDevPoll.cc b/src/comm/ModDevPoll.cc index 525587f719..50b4f435a9 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; @@ -385,7 +385,7 @@ Comm::DoSelect(int msec) PROF_start(comm_handle_ready_fd); - for (i = 0; i < num; i++) { + for (i = 0; i < num; ++i) { int fd = (int)do_poll.dp_fds[i].fd; F = &fd_table[fd]; debugs( @@ -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 9a8f986905..9a559fbcc5 100644 --- a/src/comm/ModEpoll.cc +++ b/src/comm/ModEpoll.cc @@ -283,7 +283,7 @@ Comm::DoSelect(int msec) PROF_start(comm_handle_ready_fd); - for (i = 0, cevents = pevents; i < num; i++, cevents++) { + for (i = 0, cevents = pevents; i < num; ++i, ++cevents) { fd = cevents->data.fd; F = &fd_table[fd]; debugs(5, DEBUG_EPOLL ? 0 : 8, HERE << "got FD " << fd << " events=" << @@ -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/ModKqueue.cc b/src/comm/ModKqueue.cc index 47a849ee11..cb48c11ab1 100644 --- a/src/comm/ModKqueue.cc +++ b/src/comm/ModKqueue.cc @@ -148,7 +148,7 @@ kq_update_events(int fd, short filter, PF * handler) kqoff = 0; } else { - kqoff++; + ++kqoff; } } } @@ -282,7 +282,7 @@ Comm::DoSelect(int msec) if (num == 0) return COMM_OK; /* No error.. */ - for (i = 0; i < num; i++) { + for (i = 0; i < num; ++i) { int fd = (int) ke[i].ident; PF *hdl = NULL; fde *F = &fd_table[fd]; diff --git a/src/comm/ModPoll.cc b/src/comm/ModPoll.cc index 69c7222976..7f1171e70d 100644 --- a/src/comm/ModPoll.cc +++ b/src/comm/ModPoll.cc @@ -231,7 +231,7 @@ comm_check_incoming_poll_handlers(int nfds, int *fds) pfds[npfds].fd = fd; pfds[npfds].events = events; pfds[npfds].revents = 0; - npfds++; + ++npfds; } } @@ -241,14 +241,14 @@ 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); return incoming_sockets_accepted; } - for (i = 0; i < npfds; i++) { + for (i = 0; i < npfds; ++i) { int revents; if (((revents = pfds[i].revents) == 0) || ((fd = pfds[i].fd) == -1)) @@ -396,10 +396,10 @@ Comm::DoSelect(int msec) pfds[nfds].fd = i; pfds[nfds].events = events; pfds[nfds].revents = 0; - nfds++; + ++nfds; if ((events & POLLRDNORM) && fd_table[i].flags.read_pending) - npending++; + ++npending; } } @@ -498,7 +498,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 +519,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(); diff --git a/src/comm/ModSelect.cc b/src/comm/ModSelect.cc index 699c67cb22..c4b7188e6e 100644 --- a/src/comm/ModSelect.cc +++ b/src/comm/ModSelect.cc @@ -238,12 +238,12 @@ comm_check_incoming_select_handlers(int nfds, int *fds) getCurrentTime(); - statCounter.syscalls.selects++; + ++statCounter.syscalls.selects; if (select(maxfd, &read_mask, &write_mask, NULL, &zero_tv) < 1) return incoming_sockets_accepted; - for (i = 0; i < nfds; i++) { + for (i = 0; i < nfds; ++i) { fd = fds[i]; if (FD_ISSET(fd, &read_mask)) { diff --git a/tools/purge/purge.cc b/tools/purge/purge.cc index de27261d6a..cae778c033 100644 --- a/tools/purge/purge.cc +++ b/tools/purge/purge.cc @@ -267,7 +267,7 @@ log_extended( const char* fn, int code, long size, const SquidMetaList* meta ) if ( meta && (findings = meta->search( STORE_META_KEY_MD5 )) ) { unsigned char* s = (unsigned char*) findings->data; - for ( int j=0; j<16; j++, s++ ) { + for ( int j=0; j<16; ++j, ++s ) { md5[j*2+0] = hexdigit[ *s >> 4 ]; md5[j*2+1] = hexdigit[ *s & 15 ]; }