--------------------- PatchSet 104 Date: 2002/11/01 08:21:52 Author: rbcollins Branch: esi Tag: (none) Log: esiChooseAdd->esiChoose->addElement() Members: src/ESI.cc:1.1.2.13->1.1.2.14 Index: squid3/src/ESI.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/ESI.cc,v retrieving revision 1.1.2.13 retrieving revision 1.1.2.14 diff -u -r1.1.2.13 -r1.1.2.14 --- squid3/src/ESI.cc 1 Nov 2002 02:48:38 -0000 1.1.2.13 +++ squid3/src/ESI.cc 1 Nov 2002 08:21:52 -0000 1.1.2.14 @@ -1,6 +1,6 @@ /* - * $Id: ESI.cc,v 1.1.2.13 2002/11/01 02:48:38 rbcollins Exp $ + * $Id: ESI.cc,v 1.1.2.14 2002/11/01 08:21:52 rbcollins Exp $ * * DEBUG: section 86 ESI processing * AUTHOR: Robert Collins @@ -371,6 +371,7 @@ esiChoose(); void render(esiSegment *); + bool addElement (esiElement *); esiElement ** elements; /* unprocessed nodes */ int allocedcount; size_t allocedsize; @@ -3057,11 +3058,16 @@ bool esiChooseAdd (esiElement *data, esiElement *element) { + return data->addElement (element); +} + +bool +esiChoose::addElement(esiElement *element) +{ /* add an element to the output list */ - esiChoose *thisNode = (esiChoose *)data; if (element->Vptr == &_esiLiteral) { /* Swallow whitespace */ - debug (86,5)("esiChooseAdd: Choose %p skipping whitespace %p\n",thisNode, element); + debug (86,5)("esiChooseAdd: Choose %p skipping whitespace %p\n",this, element); cbdataFree (element); return true; } @@ -3072,23 +3078,23 @@ return false; } if (element->Vptr == &_esiOtherwise) { - if (thisNode->otherwise) { + if (otherwise) { debug (86,0)("esiChooseAdd: only one otherwise node allowed for esi:choose (section 3.3)\n"); return false; } - thisNode->otherwise = element; + otherwise = element; } else { - thisNode->elements = (esiElement **)memReallocBuf (thisNode->elements, ++thisNode->elementcount * sizeof (esiElement *), - &thisNode->allocedsize); - assert (thisNode->elements); - thisNode->allocedcount = thisNode->elementcount; - thisNode->elements[thisNode->elementcount - 1] = element; - debug (86,3)("esiChooseAdd: Added a new element, elements = %d\n", thisNode->elementcount); + elements = (esiElement **)memReallocBuf (elements, ++elementcount * sizeof (esiElement *), + &allocedsize); + assert (elements); + allocedcount = elementcount; + elements[elementcount - 1] = element; + debug (86,3)("esiChooseAdd: Added a new element, elements = %d\n", elementcount); - if (thisNode->chosenelement == -1) + if (chosenelement == -1) if (((esiWhen *)element)->flags.testtrue) { - thisNode->chosenelement = thisNode->elementcount - 1; - debug (86,3)("esiChooseAdd: Chose element %d\n", thisNode->elementcount); + chosenelement = elementcount - 1; + debug (86,3)("esiChooseAdd: Chose element %d\n", elementcount); } } return true;