--------------------- PatchSet 105 Date: 2002/11/01 08:29:15 Author: rbcollins Branch: esi Tag: (none) Log: eliminate ADDELEMENT macro Members: src/ESI.cc:1.1.2.14->1.1.2.15 Index: squid3/src/ESI.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/ESI.cc,v retrieving revision 1.1.2.14 retrieving revision 1.1.2.15 diff -u -r1.1.2.14 -r1.1.2.15 --- squid3/src/ESI.cc 1 Nov 2002 08:21:52 -0000 1.1.2.14 +++ squid3/src/ESI.cc 1 Nov 2002 08:29:15 -0000 1.1.2.15 @@ -1,6 +1,6 @@ /* - * $Id: ESI.cc,v 1.1.2.14 2002/11/01 08:21:52 rbcollins Exp $ + * $Id: ESI.cc,v 1.1.2.15 2002/11/01 08:29:15 rbcollins Exp $ * * DEBUG: section 86 ESI processing * AUTHOR: Robert Collins @@ -161,13 +161,10 @@ typedef struct _esiElementType esiElementType; class esiElement; -typedef bool esiAddElement (esiElement *, esiElement *); /* add a child to an element */ -#define ADDELEMENT(foo, bar) foo->Vptr->add(foo,bar) typedef esiProcessResult_t esiProcessSelf (void *, int); /* process thisNode element */ #define PROCESS(foo, bar) foo->Vptr->process(foo, bar) struct _esiElementType { - esiAddElement *add; esiProcessSelf *process; }; struct esiElement { @@ -183,11 +180,6 @@ /* some core operators */ -static -bool addSelf(esiElement *me, esiElement *anElement) -{ - return me->addElement(anElement); -} /* the methods for each type */ static esiProcessSelf esiProcessComplete; static esiProcessSelf esiLiteralProcess; @@ -200,7 +192,6 @@ static esiProcessSelf esiTryProcess; -static esiAddElement esiChooseAdd; static esiProcessSelf esiChooseProcess; /* the types we have */ @@ -218,19 +209,19 @@ ESI_ELEMENT_OTHERWISE } esiElementType_t; -static esiElementType _esiComment = {addSelf,esiProcessComplete}; -static esiElementType _esiLiteral = {addSelf,esiLiteralProcess}; -static esiElementType _esiSequence = {addSelf,esiSequenceProcess}; -static esiElementType _esiInclude = {addSelf, esiIncludeProcess}; -static esiElementType _esiRemove = {addSelf, esiProcessComplete}; -static esiElementType _esiTry = {addSelf, esiTryProcess}; +static esiElementType _esiComment = {esiProcessComplete}; +static esiElementType _esiLiteral = {esiLiteralProcess}; +static esiElementType _esiSequence = {esiSequenceProcess}; +static esiElementType _esiInclude = {esiIncludeProcess}; +static esiElementType _esiRemove = {esiProcessComplete}; +static esiElementType _esiTry = {esiTryProcess}; /* esiAttempt, esiExcept, esiVar, esiWhen and esiOtherwise are 'Sequences' */ -static esiElementType _esiAttempt = {addSelf,esiSequenceProcess}; -static esiElementType _esiExcept = {addSelf,esiSequenceProcess}; -static esiElementType _esiVar = {addSelf,esiSequenceProcess}; -static esiElementType _esiChoose = {esiChooseAdd, esiChooseProcess}; -static esiElementType _esiWhen = {addSelf,esiSequenceProcess}; -static esiElementType _esiOtherwise= {addSelf,esiSequenceProcess}; +static esiElementType _esiAttempt = {esiSequenceProcess}; +static esiElementType _esiExcept = {esiSequenceProcess}; +static esiElementType _esiVar = {esiSequenceProcess}; +static esiElementType _esiChoose = {esiChooseProcess}; +static esiElementType _esiWhen = {esiSequenceProcess}; +static esiElementType _esiOtherwise= {esiSequenceProcess}; /* esiComment */ @@ -991,7 +982,7 @@ { /* Put on the stack to allow skipping of 'invalid' markup */ assert (context->parserState.stackdepth <11); - if (!ADDELEMENT (context->parserState.stack[context->parserState.stackdepth-1], element)) { + if (!context->parserState.stack[context->parserState.stackdepth-1]->addElement(element)) { debug (86,1)("esiProcess: failed to add esi node, probable error in ESI template\n"); context->flags.error = 1; cbdataFree (element); @@ -1214,7 +1205,7 @@ /* give a literal to the current element */ assert (context->parserState.stackdepth <11); element = esiLiteralNew (context, s, len); - if (!ADDELEMENT (context->parserState.stack[context->parserState.stackdepth-1], element)) { + if (!context->parserState.stack[context->parserState.stackdepth-1]->addElement(element)) { debug (86,1)("esiProcess: failed to add esi node, probable error in ESI template\n"); cbdataFree (element); return -1; @@ -3056,12 +3047,6 @@ } bool -esiChooseAdd (esiElement *data, esiElement *element) -{ - return data->addElement (element); -} - -bool esiChoose::addElement(esiElement *element) { /* add an element to the output list */