--------------------- PatchSet 435 Date: 2002/12/20 11:57:53 Author: rbcollins Branch: esi Tag: (none) Log: introduce min template Members: src/ESI.cc:1.1.2.50->1.1.2.51 src/squid.h:1.1.6.1->1.1.6.2 Index: squid3/src/ESI.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/ESI.cc,v retrieving revision 1.1.2.50 retrieving revision 1.1.2.51 diff -u -r1.1.2.50 -r1.1.2.51 --- squid3/src/ESI.cc 20 Dec 2002 09:16:45 -0000 1.1.2.50 +++ squid3/src/ESI.cc 20 Dec 2002 11:57:53 -0000 1.1.2.51 @@ -1,6 +1,6 @@ /* - * $Id: ESI.cc,v 1.1.2.50 2002/12/20 09:16:45 rbcollins Exp $ + * $Id: ESI.cc,v 1.1.2.51 2002/12/20 11:57:53 rbcollins Exp $ * * DEBUG: section 86 ESI processing * AUTHOR: Robert Collins @@ -845,14 +845,12 @@ /* Yes! Send it without asking for more upstream */ /* memcopying because the client provided the buffer */ /* TODO: skip data until pos == next->readoff; */ - clientStreamNode *next; - size_t len = 0; assert (thisNode->data == this); - next = thisNode->next(); + clientStreamNode *next = thisNode->next(); cbdataReference (this); + size_t len = 0; if (outbound) - len = next->readBuffer.length < (outbound->len - outbound_offset) ? - next->readBuffer.length : (outbound->len - outbound_offset); + len = min (next->readBuffer.length, outbound->len - outbound_offset); /* prevent corruption on range requests, even though we don't support them yet */ assert (pos == next->readBuffer.offset); /* We must send data or a reply */ Index: squid3/src/squid.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/squid.h,v retrieving revision 1.1.6.1 retrieving revision 1.1.6.2 diff -u -r1.1.6.1 -r1.1.6.2 --- squid3/src/squid.h 19 Dec 2002 11:25:52 -0000 1.1.6.1 +++ squid3/src/squid.h 20 Dec 2002 11:57:54 -0000 1.1.6.2 @@ -1,6 +1,6 @@ /* - * $Id: squid.h,v 1.1.6.1 2002/12/19 11:25:52 rbcollins Exp $ + * $Id: squid.h,v 1.1.6.2 2002/12/20 11:57:54 rbcollins Exp $ * * AUTHOR: Duane Wessels * @@ -360,8 +360,24 @@ #include "snprintf.h" #endif -#define XMIN(x,y) ((x)<(y)? (x) : (y)) -#define XMAX(a,b) ((a)>(b)? (a) : (b)) +template +inline A const & +min(A const & lhs, A const & rhs) +{ + if (rhs < lhs) + return rhs; + return lhs; +} +#define XMIN(x,y) (min (x,y)) +template +inline A const & +max(A const & lhs, A const & rhs) +{ + if (rhs > lhs) + return rhs; + return lhs; +} +#define XMAX(a,b) (max (a,b)) /* * Squid source files should not call these functions directly.