From: Francesco Chemolli Date: Fri, 20 Jul 2012 12:44:39 +0000 (+0200) Subject: Changed increment operators from postfix to prefix form. X-Git-Tag: sourceformat-review-1~164^2~5 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=aec55359aaff7bc358d27c5b145d4a3801c26721;p=thirdparty%2Fsquid.git Changed increment operators from postfix to prefix form. --- diff --git a/helpers/external_acl/LDAP_group/ext_ldap_group_acl.cc b/helpers/external_acl/LDAP_group/ext_ldap_group_acl.cc index 314bc93f1e..0a9fd534a3 100644 --- a/helpers/external_acl/LDAP_group/ext_ldap_group_acl.cc +++ b/helpers/external_acl/LDAP_group/ext_ldap_group_acl.cc @@ -681,12 +681,16 @@ build_filter(char *filter, int size, const char *templ, const char *user, const case '\\': ++templ; if (*templ) { - *filter++ = *templ++; + *filter = *templ; + ++filter; + ++templ; --size; } break; default: - *filter++ = *templ++; + *filter = *templ; + ++filter; + ++templ; --size; break; } diff --git a/lib/hash.cc b/lib/hash.cc index b3d3061d7d..f0e4980c8c 100644 --- a/lib/hash.cc +++ b/lib/hash.cc @@ -72,7 +72,8 @@ hash_string(const void *data, unsigned int size) unsigned int i = 0; while (*s) { ++j; - n ^= 271 * (*s++); + n ^= 271 * *s; + ++s; } i = n ^ (j * 271); return i % size; diff --git a/src/DescriptorSet.cc b/src/DescriptorSet.cc index 18268dc0f2..12d12b3c6b 100644 --- a/src/DescriptorSet.cc +++ b/src/DescriptorSet.cc @@ -37,7 +37,8 @@ DescriptorSet::add(int fd) return false; // already have it assert(size_ < capacity_); // \todo: replace with Must() - const int pos = size_++; + const int pos = size_; + ++size_; index_[fd] = pos; descriptors_[pos] = fd; return true; // really added diff --git a/src/MemObject.cc b/src/MemObject.cc index a544e976a3..7a2de16e6a 100644 --- a/src/MemObject.cc +++ b/src/MemObject.cc @@ -211,7 +211,8 @@ struct StoreClientStats : public unary_function { StoreClientStats(MemBuf *anEntry):where(anEntry),index(0) {} void operator()(store_client const &x) { - x.dumpStats(where, index++); + x.dumpStats(where, index); + ++index; } MemBuf *where; diff --git a/src/String.cc b/src/String.cc index c4c80eb3a6..ca16de82aa 100644 --- a/src/String.cc +++ b/src/String.cc @@ -416,7 +416,9 @@ strwordtok(char *buf, char **t) goto done; } - *d++ = *p++; + *d = *p; + ++d; + ++p; break; } } diff --git a/src/dns_internal.cc b/src/dns_internal.cc index 5b7d383a86..4e360fb006 100644 --- a/src/dns_internal.cc +++ b/src/dns_internal.cc @@ -1291,7 +1291,7 @@ idnsRead(int fd, void *data) fd_bytes(fd, len, FD_READ); assert(N); - (*N)++; + ++(*N); debugs(78, 3, "idnsRead: FD " << fd << ": received " << len << " bytes from " << from); diff --git a/src/esi/Esi.cc b/src/esi/Esi.cc index 5fa1b68b7e..a52d1ea2ec 100644 --- a/src/esi/Esi.cc +++ b/src/esi/Esi.cc @@ -1037,14 +1037,16 @@ ESIContext::start(const char *el, const char **attr, size_t attrCount) assert( xstrncpy(position, """, sizeof(localbuf) + (position-localbuf)) ); position += 6; } else { - *(position++) = ch; + *position = ch; + ++position; } } position += strlen (position); *position++ = '\"'; } - *position++ = '>'; + *position = '>'; + ++position; *position = '\0'; addLiteral (localbuf, position - localbuf); diff --git a/src/format/Quoting.cc b/src/format/Quoting.cc index 102b168f4a..6568941ecd 100644 --- a/src/format/Quoting.cc +++ b/src/format/Quoting.cc @@ -46,21 +46,29 @@ username_quote(const char *header) while ((c = *(const unsigned char *) header++) != '\0') { if (c == '\r') { - *buf_cursor++ = '\\'; - *buf_cursor++ = 'r'; + *buf_cursor = '\\'; + ++buf_cursor; + *buf_cursor = 'r'; + ++buf_cursor; } else if (c == '\n') { - *buf_cursor++ = '\\'; - *buf_cursor++ = 'n'; + *buf_cursor = '\\'; + ++buf_cursor; + *buf_cursor = 'n'; + ++buf_cursor; } else if (c <= 0x1F || c >= 0x7F || c == '%' || c == ' ') { - *buf_cursor++ = '%'; + *buf_cursor = '%'; + ++buf_cursor; i = c * 2; - *buf_cursor++ = c2x[i]; - *buf_cursor++ = c2x[i + 1]; + *buf_cursor = c2x[i]; + ++buf_cursor; + *buf_cursor = c2x[i + 1]; + ++buf_cursor; } else { - *buf_cursor++ = (char) c; + *buf_cursor = (char) c; + ++buf_cursor; } } diff --git a/src/gopher.cc b/src/gopher.cc index b4fac64cab..4f88131a57 100644 --- a/src/gopher.cc +++ b/src/gopher.cc @@ -492,7 +492,8 @@ gopherToHTML(GopherStateData * gopherState, char *inbuf, int len) case gopher_ds::HTML_DIR: { tline = line; - gtype = *tline++; + gtype = *tline; + ++tline; name = tline; selector = strchr(tline, TAB); diff --git a/src/icmp/Icmp.cc b/src/icmp/Icmp.cc index c6eb62ffea..838319da0a 100644 --- a/src/icmp/Icmp.cc +++ b/src/icmp/Icmp.cc @@ -69,7 +69,8 @@ Icmp::CheckSum(unsigned short *ptr, int size) sum = 0; while (size > 1) { - sum += *ptr++; + sum += *ptr; + ++ptr; size -= 2; } diff --git a/src/icmp/Icmp4.cc b/src/icmp/Icmp4.cc index e1203ab6ee..2aa7a57a09 100644 --- a/src/icmp/Icmp4.cc +++ b/src/icmp/Icmp4.cc @@ -117,7 +117,8 @@ Icmp4::SendEcho(Ip::Address &to, int opcode, const char *payload, int len) icmp->icmp_code = 0; icmp->icmp_cksum = 0; icmp->icmp_id = icmp_ident; - icmp->icmp_seq = (unsigned short) icmp_pkts_sent++; + icmp->icmp_seq = (unsigned short) icmp_pkts_sent; + ++icmp_pkts_sent; // Construct ICMP packet data content echo = (icmpEchoData *) (icmp + 1); diff --git a/src/icmp/Icmp6.cc b/src/icmp/Icmp6.cc index b2d8c1690a..206df2c896 100644 --- a/src/icmp/Icmp6.cc +++ b/src/icmp/Icmp6.cc @@ -158,7 +158,8 @@ Icmp6::SendEcho(Ip::Address &to, int opcode, const char *payload, int len) icmp->icmp6_code = 0; icmp->icmp6_cksum = 0; icmp->icmp6_id = icmp_ident; - icmp->icmp6_seq = (unsigned short) icmp_pkts_sent++; + icmp->icmp6_seq = (unsigned short) icmp_pkts_sent; + ++icmp_pkts_sent; icmp6_pktsize = sizeof(struct icmp6_hdr); diff --git a/tools/purge/copyout.cc b/tools/purge/copyout.cc index fbd659a70e..4e5da68ab4 100644 --- a/tools/purge/copyout.cc +++ b/tools/purge/copyout.cc @@ -199,7 +199,8 @@ copy_out( size_t filesize, size_t metasize, unsigned debug, // 1 || 0 | 4 | 0 | // 2 || 1 | 4 | 0 | // 3 || 4 | 2 | 0 | - state = table[ state ][ xlate(*s++) ]; + state = table[ state ][ xlate(*s) ]; + ++s; } if ( state < 4 ) diff --git a/tools/squidclient.cc b/tools/squidclient.cc index 05b5cd93dc..46205c59bb 100644 --- a/tools/squidclient.cc +++ b/tools/squidclient.cc @@ -375,7 +375,7 @@ main(int argc, char *argv[]) #endif case 'v': /* undocumented: may increase verb-level by giving more -v's */ - opt_verbose++; + ++opt_verbose; break; case '?': /* usage */ @@ -564,7 +564,7 @@ main(int argc, char *argv[]) } loops = ping ? pcount : 1; - for (i = 0; loops == 0 || i < loops; i++) { + for (i = 0; loops == 0 || i < loops; ++i) { int fsize = 0; struct addrinfo *AI = NULL;