--------------------- PatchSet 10402 Date: 2008/01/14 08:38:09 Author: adri Branch: s27_adri Tag: (none) Log: Refactor out the whitespace trimming code. Members: src/client_side.c:1.202.2.9.4.36->1.202.2.9.4.37 Index: squid/src/client_side.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/client_side.c,v retrieving revision 1.202.2.9.4.36 retrieving revision 1.202.2.9.4.37 diff -u -r1.202.2.9.4.36 -r1.202.2.9.4.37 --- squid/src/client_side.c 14 Jan 2008 08:30:22 -0000 1.202.2.9.4.36 +++ squid/src/client_side.c 14 Jan 2008 08:38:09 -0000 1.202.2.9.4.37 @@ -1,6 +1,6 @@ /* - * $Id: client_side.c,v 1.202.2.9.4.36 2008/01/14 08:30:22 adri Exp $ + * $Id: client_side.c,v 1.202.2.9.4.37 2008/01/14 08:38:09 adri Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -253,6 +253,15 @@ return (clientConnBufLen(in) >= clientConnBufCapacity(in)); } +void +clientConnBufTrimWhitespace(ConnInBuf *in) +{ + while (in->offset > 0 && xisspace(in->buf[0])) { + xmemmove(in->buf, in->buf + 1, in->offset - 1); + in->offset--; + } +} + /* Temporary here while restructuring stuff */ static void storeClientCopyHeadersCB(void *data, mem_node_ref nr, ssize_t size) @@ -4260,10 +4269,7 @@ /* Ret tells us how many bytes was consumed - 0 == didn't consume request, > 0 == consumed, -1 == error, -2 == CONNECT request stole the connection */ /* Skip leading (and trailing) whitespace */ - while (conn->in.offset > 0 && xisspace(conn->in.buf[0])) { - xmemmove(conn->in.buf, conn->in.buf + 1, conn->in.offset - 1); - conn->in.offset--; - } + clientConnBufTrimWhitespace(&conn->in); if (clientConnBufLen(&conn->in) == 0) { ret = 0; break;