]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Changed increment operators from postfix to prefix form.
authorFrancesco Chemolli <kinkie@squid-cache.org>
Mon, 16 Jul 2012 09:55:32 +0000 (11:55 +0200)
committerFrancesco Chemolli <kinkie@squid-cache.org>
Mon, 16 Jul 2012 09:55:32 +0000 (11:55 +0200)
Fixed some int-as-bool useage.

src/cf_gen.cc
src/client_db.cc
src/client_side_request.cc

index dfac371586a4f597a7085d16103595152307b44f..fc82fb200c8caef1966ffe7dacb3b10c2e7c3447 100644 (file)
@@ -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;
     }
index 0df881542eb2765a5324574fb0b4bc4ef5e530d6..c8456cebd8c0e2b31eb6fce4b2c2984c79b660af 100644 (file)
@@ -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)
index 7c738f45d105a49ac288affe3bd7ba2c19f767cc..c571336ac05713f65ecf62c8f0ff5b4470d8153c 100644 (file)
@@ -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) {