From: Amos Jeffries Date: Mon, 15 Sep 2014 00:57:29 +0000 (-0700) Subject: Portability: rename BodyPipe member to avoid clash with pipe() macro X-Git-Tag: SQUID_3_5_0_1~57 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3be4341618ead810e71c47b0b95e4785322049ab;p=thirdparty%2Fsquid.git Portability: rename BodyPipe member to avoid clash with pipe() macro 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. --- diff --git a/src/BodyPipe.cc b/src/BodyPipe.cc index 6c40873488..8a73a6ce56 100644 --- a/src/BodyPipe.cc +++ b/src/BodyPipe.cc @@ -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 &pipe, bool atEof) +void BodyProducer::stopProducingFor(RefCount &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 &pipe) +void BodyConsumer::stopConsumingFrom(RefCount &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) { diff --git a/src/BodyPipe.h b/src/BodyPipe.h index f3fdd3d759..7ee8d38ab0 100644 --- a/src/BodyPipe.h +++ b/src/BodyPipe.h @@ -31,7 +31,7 @@ public: virtual void noteBodyConsumerAborted(RefCount bp) = 0; protected: - void stopProducingFor(RefCount &pipe, bool atEof); + void stopProducingFor(RefCount &, bool atEof); }; /** Interface for those who want to consume body content from others. @@ -52,7 +52,7 @@ public: virtual void noteBodyProducerAborted(RefCount bp) = 0; protected: - void stopConsumingFrom(RefCount &pipe); + void stopConsumingFrom(RefCount &); }; /** 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