--------------------- PatchSet 482 Date: 2002/12/24 21:53:46 Author: rbcollins Branch: esi Tag: (none) Log: extract method Members: src/ESISegment.cc:1.1.2.10->1.1.2.11 src/ESISegment.h:1.1.2.10->1.1.2.11 Index: squid3/src/ESISegment.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/ESISegment.cc,v retrieving revision 1.1.2.10 retrieving revision 1.1.2.11 diff -u -r1.1.2.10 -r1.1.2.11 --- squid3/src/ESISegment.cc 24 Dec 2002 21:29:57 -0000 1.1.2.10 +++ squid3/src/ESISegment.cc 24 Dec 2002 21:53:46 -0000 1.1.2.11 @@ -1,6 +1,6 @@ /* - * $Id: ESISegment.cc,v 1.1.2.10 2002/12/24 21:29:57 rbcollins Exp $ + * $Id: ESISegment.cc,v 1.1.2.11 2002/12/24 21:53:46 rbcollins Exp $ * * DEBUG: section 86 ESI processing * AUTHOR: Robert Collins @@ -91,23 +91,30 @@ } void -ESISegment::ListAppend (ESISegment::Pointer &head, char const *s, size_t len) +ESISegment::listAppend (char const *s, size_t length) { - if (!head.getRaw()) - head = new ESISegment; - ESISegment::Pointer output = head->tail(); + assert (next.getRaw() == NULL); + ESISegment::Pointer output = this; /* copy the string to output */ size_t pos=0; - while (pos < len) { + while (pos < length) { if (output->len == sizeof (output->buf)) { assert (output->next.getRaw() == NULL); output->next = new ESISegment; output = output->next; } - pos += output->append(s + pos, len - pos); + pos += output->append(s + pos, length - pos); } } +void +ESISegment::ListAppend (ESISegment::Pointer &head, char const *s, size_t len) +{ + if (!head.getRaw()) + head = new ESISegment; + head->tail()->listAppend (s, len); +} + void * ESISegment::operator new(size_t byteCount) { Index: squid3/src/ESISegment.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/ESISegment.h,v retrieving revision 1.1.2.10 retrieving revision 1.1.2.11 diff -u -r1.1.2.10 -r1.1.2.11 --- squid3/src/ESISegment.h 24 Dec 2002 21:29:57 -0000 1.1.2.10 +++ squid3/src/ESISegment.h 24 Dec 2002 21:53:46 -0000 1.1.2.11 @@ -1,5 +1,5 @@ /* - * $Id: ESISegment.h,v 1.1.2.10 2002/12/24 21:29:57 rbcollins Exp $ + * $Id: ESISegment.h,v 1.1.2.11 2002/12/24 21:53:46 rbcollins Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -52,6 +52,7 @@ ESISegment(ESISegment const &); ESISegment::Pointer cloneList() const; char *listToChar() const; + void listAppend (char const *s, size_t length); char buf[HTTP_REQBUF_SZ]; size_t len; /* how much data has been pushed into this */