--------------------- PatchSet 10278 Date: 2007/12/19 05:47:04 Author: adri Branch: s27_adri Tag: (none) Log: Stop using string pools for now. This simplifies the code a little and the pools won't be as necessary once the buffer referencing is fully implemented. Members: libbuf/buf.c:1.1.2.4->1.1.2.5 Index: squid/libbuf/buf.c =================================================================== RCS file: /cvsroot/squid-sf//squid/libbuf/Attic/buf.c,v retrieving revision 1.1.2.4 retrieving revision 1.1.2.5 diff -u -r1.1.2.4 -r1.1.2.5 --- squid/libbuf/buf.c 19 Dec 2007 03:58:29 -0000 1.1.2.4 +++ squid/libbuf/buf.c 19 Dec 2007 05:47:04 -0000 1.1.2.5 @@ -31,7 +31,6 @@ buf_changesize(buf_t *b, int newsize) { char *p; - size_t ns; /* * buffer shouldn't ever be smaller than 'len', but we'll try @@ -44,21 +43,11 @@ if (b->flags.isfinal != 0) return 0; - /* if its empty then allocate it */ - if (b->b == NULL) { - b->b = memAllocString(newsize, &ns); - if (! b->b) - return 0; - } else if (b->size < newsize) { - p = memAllocString(newsize, &ns); - if (! p) - return 0; - memcpy(p, b->b, b->size); - memFreeString(b->size, b->b); - b->b = p; - } - - b->size = ns; + p = realloc(b->b, newsize); + if (! p) + return 0; + b->b = p; + b->size = newsize; /* truncate buffer length if/where possible */ if (b->len > b->size) { b->len = b->size; @@ -142,7 +131,7 @@ if (b->nref == 0) { debug (85, 5) ("buf_deref: %p: FREEing\n", b); if (!b->flags.isconst) { - memFreeString(b->size, b->b); + free(b->b); b->b = NULL; } memPoolFree(buf_pool, b); return NULL;