From: Francesco Chemolli Date: Mon, 16 Jul 2012 09:55:32 +0000 (+0200) Subject: Changed increment operators from postfix to prefix form. X-Git-Tag: sourceformat-review-1~164^2~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5086523ec12641a3eed34a572abab25a1ca64d38;p=thirdparty%2Fsquid.git Changed increment operators from postfix to prefix form. Fixed some int-as-bool useage. --- diff --git a/src/cf_gen.cc b/src/cf_gen.cc index dfac371586..fc82fb200c 100644 --- a/src/cf_gen.cc +++ b/src/cf_gen.cc @@ -247,7 +247,7 @@ main(int argc, char *argv[]) while (fp.getline(buff,MAX_LINE), fp.good() && state != sEXIT) { char *t; - linenum++; + ++linenum; if ((t = strchr(buff, '\n'))) *t = '\0'; @@ -297,28 +297,28 @@ main(int argc, char *argv[]) ptr = buff + 8; while (isspace((unsigned char)*ptr)) - ptr++; + ++ptr; curr.comment = ptr; } else if (!strncmp(buff, "DEFAULT:", 8)) { ptr = buff + 8; while (isspace((unsigned char)*ptr)) - ptr++; + ++ptr; curr.defaults.preset.push_back(ptr); } else if (!strncmp(buff, "DEFAULT_IF_NONE:", 16)) { ptr = buff + 16; while (isspace((unsigned char)*ptr)) - ptr++; + ++ptr; curr.defaults.if_none.push_back(ptr); } else if (!strncmp(buff, "DEFAULT_DOC:", 12)) { ptr = buff + 12; while (isspace((unsigned char)*ptr)) - ptr++; + ++ptr; curr.defaults.docs.push_back(ptr); } else if (!strncmp(buff, "LOC:", 4)) { @@ -677,7 +677,7 @@ isDefined(const std::string &name) if (!name.size()) return true; - for (int i = 0; defines[i].name; i++) { + for (int i = 0; defines[i].name; ++i) { if (name.compare(defines[i].name) == 0) return defines[i].defined; } @@ -690,7 +690,7 @@ available_if(const std::string &name) { assert(name.size()); - for (int i = 0; defines[i].name; i++) { + for (int i = 0; defines[i].name; ++i) { if (name.compare(defines[i].name) == 0) return defines[i].enable; } diff --git a/src/client_db.cc b/src/client_db.cc index 0df881542e..c8456cebd8 100644 --- a/src/client_db.cc +++ b/src/client_db.cc @@ -96,7 +96,7 @@ clientdbAdd(const Ip::Address &addr) ++statCounter.client_http.clients; if ((statCounter.client_http.clients > max_clients) && !cleanup_running && cleanup_scheduled < 2) { - cleanup_scheduled++; + ++cleanup_scheduled; eventAdd("client_db garbage collector", clientdbScheduledGC, NULL, 90, 0); } @@ -163,15 +163,15 @@ clientdbUpdate(const Ip::Address &addr, log_type ltype, AnyP::ProtocolType p, si debug_trap("clientdbUpdate: Failed to add entry"); if (p == AnyP::PROTO_HTTP) { - c->Http.n_requests++; - c->Http.result_hist[ltype]++; + ++ c->Http.n_requests; + ++ c->Http.result_hist[ltype]; kb_incr(&c->Http.kbytes_out, size); if (logTypeIsATcpHit(ltype)) kb_incr(&c->Http.hit_kbytes_out, size); } else if (p == AnyP::PROTO_ICP) { - c->Icp.n_requests++; - c->Icp.result_hist[ltype]++; + ++ c->Icp.n_requests; + ++ c->Icp.result_hist[ltype]; kb_incr(&c->Icp.kbytes_out, size); if (LOG_UDP_HIT == ltype) @@ -407,7 +407,7 @@ clientdbGC(void *unused) --statCounter.client_http.clients; - cleanup_removed++; + ++cleanup_removed; } if (bucket < CLIENT_DB_HASH_SIZE) diff --git a/src/client_side_request.cc b/src/client_side_request.cc index 7c738f45d1..c571336ac0 100644 --- a/src/client_side_request.cc +++ b/src/client_side_request.cc @@ -235,11 +235,11 @@ checkFailureRatio(err_type etype, hier_code hcode) case ERR_SECURE_CONNECT_FAIL: case ERR_READ_ERROR: - n_bad++; + ++n_bad; break; default: - n_good++; + ++n_good; } request_failure_ratio = n_bad / n_good; @@ -537,7 +537,7 @@ ClientRequestContext::hostHeaderIpVerify(const ipcache_addrs* ia, const DnsLooku if (ia != NULL && ia->count > 0) { // Is the NAT destination IP in DNS? - for (int i = 0; i < ia->count; i++) { + for (int i = 0; i < ia->count; ++i) { if (clientConn->local.matchIPAddr(ia->in_addrs[i]) == 0) { debugs(85, 3, HERE << "validate IP " << clientConn->local << " possible from Host:"); http->request->flags.hostVerified = 1; @@ -1016,7 +1016,7 @@ clientInterpretRequestHeaders(ClientHttpRequest * http) { HttpRequest *request = http->request; HttpHeader *req_hdr = &request->header; - int no_cache = 0; + bool no_cache = false; const char *str; request->imslen = -1; @@ -1030,14 +1030,14 @@ clientInterpretRequestHeaders(ClientHttpRequest * http) String s = req_hdr->getList(HDR_PRAGMA); if (strListIsMember(&s, "no-cache", ',')) - no_cache++; + no_cache=true; s.clean(); } if (request->cache_control) if (request->cache_control->noCache()) - no_cache++; + no_cache=true; /* * Work around for supporting the Reload button in IE browsers when Squid @@ -1050,20 +1050,20 @@ clientInterpretRequestHeaders(ClientHttpRequest * http) if (http->flags.accel && request->flags.ims) { if ((str = req_hdr->getStr(HDR_USER_AGENT))) { if (strstr(str, "MSIE 5.01") != NULL) - no_cache++; + no_cache=true; else if (strstr(str, "MSIE 5.0") != NULL) - no_cache++; + no_cache=true; else if (strstr(str, "MSIE 4.") != NULL) - no_cache++; + no_cache=true; else if (strstr(str, "MSIE 3.") != NULL) - no_cache++; + no_cache=true; } } } } if (request->method == METHOD_OTHER) { - no_cache++; + no_cache=true; } if (no_cache) {