--------------------- PatchSet 432 Date: 2002/12/20 08:36:10 Author: rbcollins Branch: esi Tag: (none) Log: some tidyups Members: src/ESI.cc:1.1.2.47->1.1.2.48 src/ESISegment.cc:1.1.2.4->1.1.2.5 src/ESISegment.h:1.1.2.4->1.1.2.5 Index: squid3/src/ESI.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/ESI.cc,v retrieving revision 1.1.2.47 retrieving revision 1.1.2.48 diff -u -r1.1.2.47 -r1.1.2.48 --- squid3/src/ESI.cc 20 Dec 2002 07:29:40 -0000 1.1.2.47 +++ squid3/src/ESI.cc 20 Dec 2002 08:36:10 -0000 1.1.2.48 @@ -1,6 +1,6 @@ /* - * $Id: ESI.cc,v 1.1.2.47 2002/12/20 07:29:40 rbcollins Exp $ + * $Id: ESI.cc,v 1.1.2.48 2002/12/20 08:36:10 rbcollins Exp $ * * DEBUG: section 86 ESI processing * AUTHOR: Robert Collins @@ -602,8 +602,8 @@ esiContext::fixupOutboundTail() { /* TODO: fixup thisNode outboundtail dross a little */ - while (outboundtail && outboundtail->next) - outboundtail = outboundtail->next; + if (outboundtail) + outboundtail = outboundtail->tail(); } esiKick_t @@ -1881,9 +1881,8 @@ } -esiSequence::esiSequence(esiTreeParentPtr aParent) : parent (aParent), mayFail_(true), failed (false) +esiSequence::esiSequence(esiTreeParentPtr aParent) : elements(NULL), parent (aParent), mayFail_(true), failed (false) { - elements = NULL; } bool @@ -1907,14 +1906,12 @@ /* append all processed elements, and trim processed * and rendered elements */ - int i; assert (output->next == NULL); debug (86,5)("esiSequenceRender: rendering %d elements\n", processedcount); - for (i = 0; i < processedcount; ++i) { + for (int i = 0; i < processedcount; ++i) { elements[i]->render(output); /* FIXME: pass a ESISegment ** ? */ - while (output->next) - output = output->next; + output = output->tail(); elements[i] = NULL; } if (processedcount) { @@ -1986,22 +1983,23 @@ } esiProcessResult_t -esiSequence::process (int dovars) +esiSequence::process (int inheritedVarsFlag) { - debug (86,5)("esiSequence::process: Processing %p with%s variable processing\n", this, (dovars || flags.dovars) ? "" : "out"); /* process as much of the list as we can, stopping only on * faliures */ int i; esiProcessResult_t rv = ESI_PROCESS_COMPLETE; + int dovars = inheritedVarsFlag; if (flags.dovars) dovars = 1; + debug (86,5)("esiSequence::process: Processing %p with%s variable processing\n", this, dovars ? "" : "out"); for (i = processedcount; i < elementcount; ++i) { debug (86,5)("esiSequence::process %p about to process element[%d] %p\n", this, i, elements[i].getRaw()); switch (elements[i]->process(dovars)){ case ESI_PROCESS_COMPLETE: debug (86,5)("esiSequenceProcess: %p element %p Processed OK\n", - this, elements[i].getRaw()); + this, elements[i].getRaw()); if (i == processedcount) /* another completely ready */ ++processedcount; Index: squid3/src/ESISegment.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/ESISegment.cc,v retrieving revision 1.1.2.4 retrieving revision 1.1.2.5 diff -u -r1.1.2.4 -r1.1.2.5 --- squid3/src/ESISegment.cc 20 Dec 2002 07:20:47 -0000 1.1.2.4 +++ squid3/src/ESISegment.cc 20 Dec 2002 08:36:11 -0000 1.1.2.5 @@ -1,6 +1,6 @@ /* - * $Id: ESISegment.cc,v 1.1.2.4 2002/12/20 07:20:47 rbcollins Exp $ + * $Id: ESISegment.cc,v 1.1.2.5 2002/12/20 08:36:11 rbcollins Exp $ * * DEBUG: section 86 ESI processing * AUTHOR: Robert Collins @@ -147,3 +147,21 @@ len += toCopy; return toCopy; } + +ESISegment const * +ESISegment::tail() const +{ + ESISegment const *result = this; + while (result->next) + result = result->next; + return result; +} + +ESISegment * +ESISegment::tail() +{ + ESISegment *result = this; + while (result->next) + result = result->next; + return result; +} Index: squid3/src/ESISegment.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/ESISegment.h,v retrieving revision 1.1.2.4 retrieving revision 1.1.2.5 diff -u -r1.1.2.4 -r1.1.2.5 --- squid3/src/ESISegment.h 20 Dec 2002 07:20:47 -0000 1.1.2.4 +++ squid3/src/ESISegment.h 20 Dec 2002 08:36:11 -0000 1.1.2.5 @@ -1,5 +1,5 @@ /* - * $Id: ESISegment.h,v 1.1.2.4 2002/12/20 07:20:47 rbcollins Exp $ + * $Id: ESISegment.h,v 1.1.2.5 2002/12/20 08:36:11 rbcollins Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -49,6 +49,8 @@ size_t len; /* how much data has been pushed into this */ ESISegment *next; size_t append(char const *, size_t); + ESISegment const *tail() const; + ESISegment *tail(); }; extern void ESISegmentFreeList (ESISegment **head);