]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Portability: rename BodyPipe member to avoid clash with pipe() macro
authorAmos Jeffries <squid3@treenet.co.nz>
Mon, 15 Sep 2014 00:57:29 +0000 (17:57 -0700)
committerAmos Jeffries <squid3@treenet.co.nz>
Mon, 15 Sep 2014 00:57:29 +0000 (17:57 -0700)
Our Windows compatibility layer defines pipe() as a macro. On MinGW at
least the precompiler makes no distinction between parameterless macro
pipe() and pipe variables.
Use thePipe for member naming and aPipe for function local variables.

src/BodyPipe.cc
src/BodyPipe.h

index 6c408734887a61b7126432ed644efcddf2f718b3..8a73a6ce5615cc17f3c03809e22e35bf471da101 100644 (file)
@@ -78,10 +78,9 @@ BodyProducerDialer::canDial(AsyncCall &call)
         return false;
 
     const BodyProducer::Pointer &producer = job;
-    BodyPipe::Pointer pipe = arg1;
-    if (!pipe->stillProducing(producer)) {
-        debugs(call.debugSection, call.debugLevel, HERE << producer <<
-               " no longer producing for " << pipe->status());
+    BodyPipe::Pointer aPipe = arg1;
+    if (!aPipe->stillProducing(producer)) {
+        debugs(call.debugSection, call.debugLevel, producer << " no longer producing for " << aPipe->status());
         return call.cancel("no longer producing");
     }
 
@@ -95,10 +94,9 @@ BodyConsumerDialer::canDial(AsyncCall &call)
         return false;
 
     const BodyConsumer::Pointer &consumer = job;
-    BodyPipe::Pointer pipe = arg1;
-    if (!pipe->stillConsuming(consumer)) {
-        debugs(call.debugSection, call.debugLevel, HERE << consumer <<
-               " no longer consuming from " << pipe->status());
+    BodyPipe::Pointer aPipe = arg1;
+    if (!aPipe->stillConsuming(consumer)) {
+        debugs(call.debugSection, call.debugLevel, consumer << " no longer consuming from " << aPipe->status());
         return call.cancel("no longer consuming");
     }
 
@@ -108,24 +106,23 @@ BodyConsumerDialer::canDial(AsyncCall &call)
 /* BodyProducer */
 
 // inform the pipe that we are done and clear the Pointer
-void BodyProducer::stopProducingFor(RefCount<BodyPipe> &pipe, bool atEof)
+void BodyProducer::stopProducingFor(RefCount<BodyPipe> &p, bool atEof)
 {
-    debugs(91,7, HERE << this << " will not produce for " << pipe <<
-           "; atEof: " << atEof);
-    assert(pipe != NULL); // be strict: the caller state may depend on this
-    pipe->clearProducer(atEof);
-    pipe = NULL;
+    debugs(91,7, this << " will not produce for " << p << "; atEof: " << atEof);
+    assert(p != NULL); // be strict: the caller state may depend on this
+    p->clearProducer(atEof);
+    p = NULL;
 }
 
 /* BodyConsumer */
 
 // inform the pipe that we are done and clear the Pointer
-void BodyConsumer::stopConsumingFrom(RefCount<BodyPipe> &pipe)
+void BodyConsumer::stopConsumingFrom(RefCount<BodyPipe> &p)
 {
-    debugs(91,7, HERE << this << " will not consume from " << pipe);
-    assert(pipe != NULL); // be strict: the caller state may depend on this
-    pipe->clearConsumer();
-    pipe = NULL;
+    debugs(91,7, this << " will not consume from " << p);
+    assert(p != NULL); // be strict: the caller state may depend on this
+    p->clearConsumer();
+    p = NULL;
 }
 
 /* BodyPipe */
@@ -479,7 +476,7 @@ const char *BodyPipe::status() const
 
 /* BodyPipeCheckout */
 
-BodyPipeCheckout::BodyPipeCheckout(BodyPipe &aPipe): pipe(aPipe),
+BodyPipeCheckout::BodyPipeCheckout(BodyPipe &aPipe): thePipe(aPipe),
         buf(aPipe.checkOut()), offset(aPipe.consumedSize()),
         checkedOutSize(buf.contentSize()), checkedIn(false)
 {
@@ -492,7 +489,7 @@ BodyPipeCheckout::~BodyPipeCheckout()
         // TODO: consider implementing the long-term solution discussed at
         // http://www.mail-archive.com/squid-dev@squid-cache.org/msg07910.html
         debugs(91,2, HERE << "Warning: cannot undo BodyPipeCheckout");
-        pipe.checkIn(*this);
+        thePipe.checkIn(*this);
     }
 }
 
@@ -500,11 +497,11 @@ void
 BodyPipeCheckout::checkIn()
 {
     assert(!checkedIn);
-    pipe.checkIn(*this);
+    thePipe.checkIn(*this);
     checkedIn = true;
 }
 
-BodyPipeCheckout::BodyPipeCheckout(const BodyPipeCheckout &c): pipe(c.pipe),
+BodyPipeCheckout::BodyPipeCheckout(const BodyPipeCheckout &c): thePipe(c.thePipe),
         buf(c.buf), offset(c.offset), checkedOutSize(c.checkedOutSize),
         checkedIn(c.checkedIn)
 {
index f3fdd3d75963bd1cde050938a9ba7d27f812c2b8..7ee8d38ab017f8dc4b8debff99a7afa4c6495d4d 100644 (file)
@@ -31,7 +31,7 @@ public:
     virtual void noteBodyConsumerAborted(RefCount<BodyPipe> bp) = 0;
 
 protected:
-    void stopProducingFor(RefCount<BodyPipe> &pipe, bool atEof);
+    void stopProducingFor(RefCount<BodyPipe> &, bool atEof);
 };
 
 /** Interface for those who want to consume body content from others.
@@ -52,7 +52,7 @@ public:
     virtual void noteBodyProducerAborted(RefCount<BodyPipe> bp) = 0;
 
 protected:
-    void stopConsumingFrom(RefCount<BodyPipe> &pipe);
+    void stopConsumingFrom(RefCount<BodyPipe> &);
 };
 
 /** Makes raw buffer checkin/checkout interface efficient and exception-safe.
@@ -64,13 +64,13 @@ public:
     friend class BodyPipe;
 
 public:
-    BodyPipeCheckout(BodyPipe &pipe); // checks out
+    BodyPipeCheckout(BodyPipe &); // checks out
     ~BodyPipeCheckout(); // aborts checkout unless checkedIn
 
     void checkIn();
 
 public:
-    BodyPipe &pipe;
+    BodyPipe &thePipe;
     MemBuf &buf;
     const uint64_t offset; // of current content, relative to the body start