From: Francesco Chemolli Date: Mon, 23 Jul 2012 19:37:47 +0000 (+0200) Subject: Changed some increment/decrement operators from postfix to prefix form. X-Git-Tag: sourceformat-review-1~164^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f412b2d605acb123165ab40d0fd97ea6af003fe3;p=thirdparty%2Fsquid.git Changed some increment/decrement operators from postfix to prefix form. --- diff --git a/lib/ntlmauth/support_bits.cci b/lib/ntlmauth/support_bits.cci index a13c5e9771..c59695a888 100644 --- a/lib/ntlmauth/support_bits.cci +++ b/lib/ntlmauth/support_bits.cci @@ -18,7 +18,7 @@ uc(char *string) char *p = string, c; while ((c = *p)) { *p = xtoupper(c); - p++; + ++p; } } @@ -29,7 +29,7 @@ lc(char *string) char *p = string, c; while ((c = *p)) { *p = xtolower(c); - p++; + ++p; } } @@ -53,7 +53,7 @@ hex_dump(unsigned char *data, int size) char addrstr[10] = {0}; char hexstr[16 * 3 + 5] = {0}; char charstr[16 * 1 + 5] = {0}; - for (n = 1; n <= size; n++) { + for (n = 1; n <= size; ++n) { if (n % 16 == 1) { /* store address for this line */ snprintf(addrstr, sizeof(addrstr), "%.4x", (int) (p - data)); @@ -80,7 +80,7 @@ hex_dump(unsigned char *data, int size) strncat(hexstr, " ", sizeof(hexstr) - strlen(hexstr) - 1); strncat(charstr, " ", sizeof(charstr) - strlen(charstr) - 1); } - p++; /* next byte */ + ++p; /* next byte */ } if (strlen(hexstr) > 0) { diff --git a/src/Parsing.cc b/src/Parsing.cc index 0058ee77a8..47aa616821 100644 --- a/src/Parsing.cc +++ b/src/Parsing.cc @@ -179,7 +179,8 @@ GetHostWithPort(char *token, Ip::Address *ipa) t = strchr(host, ']'); if (!t) return false; - *t++ = '\0'; + *t = '\0'; + ++t; if (*t != ':') return false; port = xatos(t + 1); diff --git a/src/StoreMetaUnpacker.cc b/src/StoreMetaUnpacker.cc index bd42702fe8..a97edbcf4d 100644 --- a/src/StoreMetaUnpacker.cc +++ b/src/StoreMetaUnpacker.cc @@ -92,7 +92,8 @@ StoreMetaUnpacker::StoreMetaUnpacker (char const *aBuffer, ssize_t aLen, int *an void StoreMetaUnpacker::getType() { - type = buf[position++]; + type = buf[position]; + ++position; } void diff --git a/src/SwapDir.cc b/src/SwapDir.cc index 867fd7f5f2..0e20ae5964 100644 --- a/src/SwapDir.cc +++ b/src/SwapDir.cc @@ -244,8 +244,10 @@ SwapDir::parseOptions(int isaReconfig) while ((name = strtok(NULL, w_space)) != NULL) { value = strchr(name, '='); - if (value) - *value++ = '\0'; /* cut on = */ + if (value) { + *value = '\0'; /* cut on = */ + ++value; + } debugs(3,2, "SwapDir::parseOptions: parsing store option '" << name << "'='" << (value ? value : "") << "'"); diff --git a/src/comm/ModSelectWin32.cc b/src/comm/ModSelectWin32.cc index 8d30690e88..4d3cf7ebaa 100644 --- a/src/comm/ModSelectWin32.cc +++ b/src/comm/ModSelectWin32.cc @@ -403,7 +403,7 @@ Comm::DoSelect(int msec) register int readfds_handle = readfds.fd_array[j]; no_bits = 1; - for ( fd = Biggest_FD; fd; fd-- ) { + for ( fd = Biggest_FD; fd; --fd ) { if ( fd_table[fd].win32.handle == readfds_handle ) { if (fd_table[fd].flags.open) { no_bits = 0; @@ -490,7 +490,7 @@ Comm::DoSelect(int msec) register int osfhandle; no_bits = 1; - for ( fd = Biggest_FD; fd; fd-- ) { + for ( fd = Biggest_FD; fd; --fd ) { osfhandle = fd_table[fd].win32.handle; if (( osfhandle == readfds_handle ) || @@ -554,7 +554,7 @@ Comm::DoSelect(int msec) for (j = 0; j < (int) errfds.fd_count; ++j) { register int errfds_handle = errfds.fd_array[j]; - for ( fd = Biggest_FD; fd; fd-- ) { + for ( fd = Biggest_FD; fd; --fd ) { if ( fd_table[fd].win32.handle == errfds_handle ) break; } @@ -577,7 +577,7 @@ Comm::DoSelect(int msec) register int writefds_handle = writefds.fd_array[j]; no_bits = 1; - for ( fd = Biggest_FD; fd; fd-- ) { + for ( fd = Biggest_FD; fd; --fd ) { if ( fd_table[fd].win32.handle == writefds_handle ) { if (fd_table[fd].flags.open) { no_bits = 0; diff --git a/src/ip/Qos.cci b/src/ip/Qos.cci index 7d7c4a9e35..035f8a864e 100644 --- a/src/ip/Qos.cci +++ b/src/ip/Qos.cci @@ -49,7 +49,7 @@ Ip::Qos::Config::isAclNfmarkActive() const { acl_nfmark * nfmarkAcls [] = { nfmarkToServer, nfmarkToClient }; - for (int i=0; i<2; i++) { + for (int i=0; i<2; ++i) { while (nfmarkAcls[i]) { acl_nfmark *l = nfmarkAcls[i]; if (l->nfmark > 0) @@ -66,7 +66,7 @@ Ip::Qos::Config::isAclTosActive() const { acl_tos * tosAcls [] = { tosToServer, tosToClient }; - for (int i=0; i<2; i++) { + for (int i=0; i<2; ++i) { while (tosAcls[i]) { acl_tos *l = tosAcls[i]; if (l->tos > 0) diff --git a/src/ipc_win32.cc b/src/ipc_win32.cc index 527fdfddc2..e67322d49a 100644 --- a/src/ipc_win32.cc +++ b/src/ipc_win32.cc @@ -566,7 +566,8 @@ ipc_thread_1(void *in_params) x = 1; while (args[x]) { - strcat(buf1, args[x++]); + strcat(buf1, args[x]); + ++x; strcat(buf1, " "); } diff --git a/src/mem.cc b/src/mem.cc index 4cdc9ddb61..ada71546e0 100644 --- a/src/mem.cc +++ b/src/mem.cc @@ -764,10 +764,13 @@ Mem::Report(std::ostream &stream) if (!mp_stats.pool) /* pool destroyed */ continue; - if (mp_stats.pool->getMeter().gb_allocated.count > 0) /* this pool has been used */ - sortme[npools++] = mp_stats; - else + if (mp_stats.pool->getMeter().gb_allocated.count > 0) { + /* this pool has been used */ + sortme[npools] = mp_stats; + ++npools; + } else { ++not_used; + } } memPoolIterateDone(&iter); diff --git a/src/pconn.cc b/src/pconn.cc index 326d118d3d..3cc57a0b21 100644 --- a/src/pconn.cc +++ b/src/pconn.cc @@ -150,7 +150,8 @@ IdleConnList::closeN(size_t n) } // ensure the last N entries are unset while (index < ((size_t)size_)) { - theList_[index++] = NULL; + theList_[index] = NULL; + ++index; } size_ -= n; } @@ -186,7 +187,8 @@ IdleConnList::push(const Comm::ConnectionPointer &conn) if (parent_) parent_->noteConnectionAdded(); - theList_[size_++] = conn; + theList_[size_] = conn; + ++size_; AsyncCall::Pointer readCall = commCbCall(5,4, "IdleConnList::Read", CommIoCbPtrFun(IdleConnList::Read, this)); comm_read(conn, fakeReadBuf_, sizeof(fakeReadBuf_), readCall); diff --git a/src/snmp_core.cc b/src/snmp_core.cc index 86f7b3010f..940b0d0a77 100644 --- a/src/snmp_core.cc +++ b/src/snmp_core.cc @@ -1160,7 +1160,7 @@ public: virtual int match (ACLData * &, ACLFilledChecklist *); static ACLSNMPCommunityStrategy *Instance(); /* Not implemented to prevent copies of the instance. */ - /* Not private to prevent brain dead g+++ warnings about + /* Not private to prevent brain dead g++ warnings about * private constructors with no friends */ ACLSNMPCommunityStrategy(ACLSNMPCommunityStrategy const &); diff --git a/tools/purge/purge.cc b/tools/purge/purge.cc index a23b07bdf2..f0eecc49b2 100644 --- a/tools/purge/purge.cc +++ b/tools/purge/purge.cc @@ -674,8 +674,10 @@ parseCommandline( int argc, char* argv[], REList*& head, } // remove trailing line breaks - while ( len > 0 && ( line[len] == '\n' || line[len] == '\r' ) ) - line[len--] = '\0'; + while ( len > 0 && ( line[len] == '\n' || line[len] == '\r' ) ) { + line[len] = '\0'; + --len; + } // insert into list of expressions if ( head == 0 ) tail = head = new REList(line,option=='F');