]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fixed some cases of variable shadowing
authorFrancesco Chemolli <kinkie@squid-cache.org>
Wed, 18 Nov 2009 16:31:08 +0000 (17:31 +0100)
committerFrancesco Chemolli <kinkie@squid-cache.org>
Wed, 18 Nov 2009 16:31:08 +0000 (17:31 +0100)
src/adaptation/History.cc
src/adaptation/Iterator.cc
src/adaptation/ServiceGroups.cc
src/adaptation/icap/ModXact.cc
src/adaptation/icap/OptXact.cc
src/adaptation/icap/ServiceRep.cc
src/esi/Esi.cc
src/esi/VarState.cc
src/icmp/Icmp6.cc

index 70be7baaea2c386e34fde9bfd548a298aae7c5c1..4733b5aef3e77ec1cea67428c328eab92f23b0ca 100644 (file)
@@ -9,8 +9,8 @@
 /// impossible services value to identify unset theNextServices
 const static char *TheNullServices = ",null,";
 
-Adaptation::History::Entry::Entry(const String &sid, const timeval &when):
-        service(sid), start(when), theRptm(-1), retried(false)
+Adaptation::History::Entry::Entry(const String &serviceId, const timeval &when):
+        service(serviceId), start(when), theRptm(-1), retried(false)
 {
 }
 
@@ -37,13 +37,13 @@ Adaptation::History::History(): theNextServices(TheNullServices)
 {
 }
 
-int Adaptation::History::recordXactStart(const String &sid, const timeval &when, bool retrying)
+int Adaptation::History::recordXactStart(const String &serviceId, const timeval &when, bool retrying)
 {
     if (retrying) {
         Must(!theEntries.empty()); // or there would be nothing to retry
         theEntries.back().retried = true;
     }
-    theEntries.push_back(Adaptation::History::Entry(sid, when));
+    theEntries.push_back(Adaptation::History::Entry(serviceId, when));
     return theEntries.size() - 1; // record position becomes history ID
 }
 
index c422846031a9e0bdc9d02375073f32dc3f76fda1..1b903faf0a2c0dcab73a3f0f4907445099c3a030 100644 (file)
@@ -196,10 +196,10 @@ Adaptation::ServiceFilter Adaptation::Iterator::filter() const
         method = methodReqmod;
         req = r;
         rep = NULL;
-    } else if (HttpReply *r = dynamic_cast<HttpReply*>(theMsg)) {
+    } else if (HttpReply *theReply = dynamic_cast<HttpReply*>(theMsg)) {
         method = methodRespmod;
         req = theCause;
-        rep = r;
+        rep = theReply;
     } else {
         Must(false); // should not happen
     }
index 8787b293a45f28be87009469cff945c98bf7f63e..a680b17e9c66ae323cfe4f5cc8d8a78569845990 100644 (file)
@@ -45,7 +45,7 @@ Adaptation::ServiceGroup::finalize()
     bool baselineBypass = false;
     for (Pos pos = 0; has(pos); ++pos) {
         // TODO: quit on all errors
-        const String &sid = services[pos];
+        const String &serviceId = services[pos];
         ServicePointer service = at(pos);
         if (service != NULL) {
             if (method == methodNone) {
@@ -54,9 +54,9 @@ Adaptation::ServiceGroup::finalize()
                 point = service->cfg().point;
             } else {
                 if (method != service->cfg().method)
-                    finalizeMsg("Inconsistent service method for", sid, true);
+                    finalizeMsg("Inconsistent service method for", serviceId, true);
                 if (point != service->cfg().point)
-                    finalizeMsg("Inconsistent vectoring point for", sid, true);
+                    finalizeMsg("Inconsistent vectoring point for", serviceId, true);
             }
 
             checkUniqueness(pos);
@@ -68,11 +68,11 @@ Adaptation::ServiceGroup::finalize()
                 } else if (baselineBypass != service->cfg().bypass) {
                     debugs(93,0, "WARNING: Inconsistent bypass in " << kind <<
                            ' ' << id << " may produce surprising results: " <<
-                           baselineKey << " vs. " << sid);
+                           baselineKey << " vs. " << serviceId);
                 }
             }
         } else {
-            finalizeMsg("ERROR: Unknown adaptation name", sid, true);
+            finalizeMsg("ERROR: Unknown adaptation name", serviceId, true);
         }
     }
     debugs(93,7, HERE << "finalized " << kind << ": " << id);
index c99d33dce4a4239cbbfd6786d7c2dde55a81eb25..70ba8679d3e878ad23ca71398e0cbfeb4fe89718 100644 (file)
@@ -337,20 +337,20 @@ size_t Adaptation::Icap::ModXact::virginContentSize(const Adaptation::Icap::Virg
 {
     Must(act.active());
     // asbolute start of unprocessed data
-    const uint64_t start = act.offset();
+    const uint64_t dataStart = act.offset();
     // absolute end of buffered data
-    const uint64_t end = virginConsumed + virgin.body_pipe->buf().contentSize();
-    Must(virginConsumed <= start && start <= end);
-    return static_cast<size_t>(end - start);
+    const uint64_t dataEnd = virginConsumed + virgin.body_pipe->buf().contentSize();
+    Must(virginConsumed <= dataStart && dataStart <= dataEnd);
+    return static_cast<size_t>(dataEnd - dataStart);
 }
 
 // pointer to buffered virgin body data available for the specified activity
 const char *Adaptation::Icap::ModXact::virginContentData(const Adaptation::Icap::VirginBodyAct &act) const
 {
     Must(act.active());
-    const uint64_t start = act.offset();
-    Must(virginConsumed <= start);
-    return virgin.body_pipe->buf().content() + static_cast<size_t>(start-virginConsumed);
+    const uint64_t dataStart = act.offset();
+    Must(virginConsumed <= dataStart);
+    return virgin.body_pipe->buf().content() + static_cast<size_t>(dataStart-virginConsumed);
 }
 
 void Adaptation::Icap::ModXact::virginConsume()
@@ -1700,7 +1700,7 @@ void Adaptation::Icap::ModXactLauncher::swanSong()
     Adaptation::Icap::Launcher::swanSong();
 }
 
-void Adaptation::Icap::ModXactLauncher::updateHistory(bool start)
+void Adaptation::Icap::ModXactLauncher::updateHistory(bool doStart)
 {
     HttpRequest *r = virgin.cause ?
                      virgin.cause : dynamic_cast<HttpRequest*>(virgin.header);
@@ -1709,7 +1709,7 @@ void Adaptation::Icap::ModXactLauncher::updateHistory(bool start)
     if (r) {
         Adaptation::Icap::History::Pointer h = r->icapHistory();
         if (h != NULL) {
-            if (start)
+            if (doStart)
                 h->start("ICAPModXactLauncher");
             else
                 h->stop("ICAPModXactLauncher");
index 5219cc9b0a6fba620ff24e6782fe97c507804ca3..0eb53af1debb4dbf2972ba83d29d85855f767020 100644 (file)
@@ -52,8 +52,8 @@ void Adaptation::Icap::OptXact::makeRequest(MemBuf &buf)
     buf.append(ICAP::crlf, 2);
 
     // XXX: HttpRequest cannot fully parse ICAP Request-Line
-    http_status status;
-    Must(icapRequest->parse(&buf, true, &status) > 0);
+    http_status reqStatus;
+    Must(icapRequest->parse(&buf, true, &reqStatus) > 0);
 }
 
 void Adaptation::Icap::OptXact::handleCommWrote(size_t size)
index f5fd4d05a6e1a3a5db8126dd7845f8f8fc6642d9..c6a0740050a9bec5aaa3ae6d0c5ca65ff2214f1a 100644 (file)
@@ -15,8 +15,8 @@
 
 CBDATA_NAMESPACED_CLASS_INIT(Adaptation::Icap, ServiceRep);
 
-Adaptation::Icap::ServiceRep::ServiceRep(const Adaptation::ServiceConfig &cfg):
-        AsyncJob("Adaptation::Icap::ServiceRep"), Adaptation::Service(cfg),
+Adaptation::Icap::ServiceRep::ServiceRep(const Adaptation::ServiceConfig &svcCfg):
+        AsyncJob("Adaptation::Icap::ServiceRep"), Adaptation::Service(svcCfg),
         theOptions(NULL), theOptionsFetcher(0), theLastUpdate(0),
         theSessionFailures(0), isSuspended(0), notifying(false),
         updateScheduled(false), self(NULL),
index ebf2df411efddaed1ecdc4bced752c6440d93b02..472887abda54e34f692204ab1edb56c6262ce943 100644 (file)
@@ -1004,7 +1004,7 @@ ESIContext::start(const char *el, const char **attr, size_t attrCount)
     char localbuf [HTTP_REQBUF_SZ];
     ESIElement::Pointer element;
     int specifiedattcount = attrCount * 2;
-    char *pos;
+    char *position;
     assert (ellen < sizeof (localbuf)); /* prevent unexpected overruns. */
 
     debugs(86, 5, "ESIContext::Start: element '" << el << "' with " << specifiedattcount << " tags");
@@ -1020,33 +1020,33 @@ ESIContext::start(const char *el, const char **attr, size_t attrCount)
         localbuf[0] = '<';
         localbuf[1] = '\0';
         assert (xstrncpy (&localbuf[1], el, sizeof(localbuf) - 2));
-        pos = localbuf + strlen (localbuf);
+        position = localbuf + strlen (localbuf);
 
         for (i = 0; i < specifiedattcount && attr[i]; i += 2) {
-            *pos++ = ' ';
+            *position++ = ' ';
             /* TODO: handle thisNode gracefully */
-            assert (xstrncpy (pos, attr[i], sizeof(localbuf) + (pos - localbuf)));
-            pos += strlen (pos);
-            *pos++ = '=';
-            *pos++ = '\"';
+            assert (xstrncpy (position, attr[i], sizeof(localbuf) + (position - localbuf)));
+            position += strlen (position);
+            *position++ = '=';
+            *position++ = '\"';
             const char *chPtr = attr[i + 1];
             char ch;
             while ((ch = *chPtr++) != '\0') {
                 if (ch == '\"') {
-                    assert( xstrncpy(pos, "&quot;", sizeof(localbuf) + (pos-localbuf)) );
-                    pos += 6;
+                    assert( xstrncpy(position, "&quot;", sizeof(localbuf) + (position-localbuf)) );
+                    position += 6;
                 } else {
-                    *(pos++) = ch;
+                    *(position++) = ch;
                 }
             }
-            pos += strlen (pos);
-            *pos++ = '\"';
+            position += strlen (position);
+            *position++ = '\"';
         }
 
-        *pos++ = '>';
-        *pos = '\0';
+        *position++ = '>';
+        *position = '\0';
 
-        addLiteral (localbuf, pos - localbuf);
+        addLiteral (localbuf, position - localbuf);
         debugs(86, 5, "esi stack depth " << parserState.stackdepth);
         return;
         break;
@@ -1118,7 +1118,7 @@ ESIContext::end(const char *el)
 {
     unsigned int ellen = strlen (el);
     char localbuf [HTTP_REQBUF_SZ];
-    char *pos;
+    char *position;
 
     if (flags.error)
         /* waiting for expat to finish the buffer we gave it */
@@ -1132,10 +1132,10 @@ ESIContext::end(const char *el)
         localbuf[0] = '<';
         localbuf[1] = '/';
         assert (xstrncpy (&localbuf[2], el, sizeof(localbuf) - 3));
-        pos = localbuf + strlen (localbuf);
-        *pos++ = '>';
-        *pos = '\0';
-        addLiteral (localbuf, pos - localbuf);
+        position = localbuf + strlen (localbuf);
+        *position++ = '>';
+        *position = '\0';
+        addLiteral (localbuf, position - localbuf);
         break;
 
     case ESIElement::ESI_ELEMENT_COMMENT:
index db9181c2bad6d944d6ee264e74a1c4512581241b..ba414c6b1ddedbf908c4bfbd0ced5b646bf2a4c6 100644 (file)
@@ -592,7 +592,7 @@ public:
 
 private:
     bool validChar (char c);
-    void eval (ESIVarState::Variable *var, char const *subref, char const *found_default );
+    void eval (ESIVarState::Variable *var, char const *subref, char const *foundDefault );
     void doFunction();
     void identifyFunction();
     char *string;
@@ -611,14 +611,14 @@ private:
 };
 
 void
-ESIVariableProcessor::eval (ESIVarState::Variable *var, char const *subref, char const *found_default )
+ESIVariableProcessor::eval (ESIVarState::Variable *var, char const *subref, char const *foundDefault )
 {
     assert (var);
 
-    if (!found_default)
-        found_default = "";
+    if (!foundDefault)
+        foundDefault = "";
 
-    var->eval (*varState, subref, found_default);
+    var->eval (*varState, subref, foundDefault);
 }
 
 bool
index b61d4fe9919e1e465a2901ae0b79d8a2e573d518..9f0e492ba07941fb5ce676ec9cc3319659de3b92 100644 (file)
@@ -213,7 +213,7 @@ Icmp6::Recv(void)
     struct addrinfo *from = NULL;
 //    struct ip6_hdr *ip = NULL;
     static char *pkt = NULL;
-    struct icmp6_hdr *icmp6 = NULL;
+    struct icmp6_hdr *icmp6header = NULL;
     icmpEchoData *echo = NULL;
     struct timeval now;
     static pingerReplyData preply;
@@ -278,12 +278,12 @@ Icmp6::Recv(void)
     );
     */
 
-    icmp6 = (struct icmp6_hdr *) pkt;
+    icmp6header = (struct icmp6_hdr *) pkt;
     pkt += sizeof(icmp6_hdr);
 
-    if (icmp6->icmp6_type != ICMP6_ECHO_REPLY) {
+    if (icmp6header->icmp6_type != ICMP6_ECHO_REPLY) {
 
-        switch (icmp6->icmp6_type) {
+        switch (icmp6header->icmp6_type) {
         case 134:
         case 135:
         case 136:
@@ -291,15 +291,15 @@ Icmp6::Recv(void)
             break;
 
         default:
-            debugs(42, 8, HERE << preply.from << " said: " << icmp6->icmp6_type << "/" << (int)icmp6->icmp6_code << " " <<
-                   ( icmp6->icmp6_type&0x80 ? icmp6HighPktStr[(int)(icmp6->icmp6_type&0x7f)] : icmp6LowPktStr[(int)(icmp6->icmp6_type&0x7f)] )
+            debugs(42, 8, HERE << preply.from << " said: " << icmp6header->icmp6_type << "/" << (int)icmp6header->icmp6_code << " " <<
+                   ( icmp6header->icmp6_type&0x80 ? icmp6HighPktStr[(int)(icmp6header->icmp6_type&0x7f)] : icmp6LowPktStr[(int)(icmp6header->icmp6_type&0x7f)] )
                   );
         }
         return;
     }
 
-    if (icmp6->icmp6_id != icmp_ident) {
-        debugs(42, 8, HERE << "dropping Icmp6 read. IDENT check failed. ident=='" << icmp_ident << "'=='" << icmp6->icmp6_id << "'");
+    if (icmp6header->icmp6_id != icmp_ident) {
+        debugs(42, 8, HERE << "dropping Icmp6 read. IDENT check failed. ident=='" << icmp_ident << "'=='" << icmp6header->icmp6_id << "'");
         return;
     }
 
@@ -329,8 +329,8 @@ Icmp6::Recv(void)
     }
 
     Log(preply.from,
-        icmp6->icmp6_type,
-        ( icmp6->icmp6_type&0x80 ? icmp6HighPktStr[(int)(icmp6->icmp6_type&0x7f)] : icmp6LowPktStr[(int)(icmp6->icmp6_type&0x7f)] ),
+        icmp6header->icmp6_type,
+        ( icmp6header->icmp6_type&0x80 ? icmp6HighPktStr[(int)(icmp6header->icmp6_type&0x7f)] : icmp6LowPktStr[(int)(icmp6header->icmp6_type&0x7f)] ),
         preply.rtt,
         preply.hops);