Re: [Squid-cvs] squid/lib MemPool.c,1.2,1.3 util.c,1.13,1.14

From: Andres Kroonmaa <andre@dont-contact.us>
Date: Mon, 8 Apr 2002 09:50:09 +0300

 Henrik,

On 6 Apr 2002, at 7:31, Squid project administrator <squidadm@users.sourceforge.net> wrote:

> Synchronized with cvs.squid-cache.org
>
> Index: MemPool.c
> ===================================================================
> RCS file: /cvsroot/squid//squid/lib/MemPool.c,v
> retrieving revision 1.2
> retrieving revision 1.3
> diff -w -u -r1.2 -r1.3
> --- MemPool.c 6 Apr 2002 11:34:49 -0000 1.2
> +++ MemPool.c 6 Apr 2002 15:31:26 -0000 1.3
> @@ -184,7 +184,12 @@
> static int
> memCompChunks(MemChunk * chunkA, MemChunk * chunkB)
> {
> - return chunkA->objCache - chunkB->objCache;
> + if (chunkA > chunkB)
> + return 1;
> + else if (chunkA < chunkB)
> + return -1;
> + else
> + return 0;
> }

 This changes sense of comparison. Struct chunk is small,
 objCache is large. Above specifically tries to compare
 pointers to objCaches, not chunk structs. I can't pass
 objcache pointers to splay sort also, as splay handles
 chunk structs, thats why such wrapper.

> /* Compare object to chunk */
> @@ -192,7 +197,7 @@
> memCompObjChunks(void *obj, MemChunk * chunk)
> {
> int bounds;
> - bounds = obj - chunk->objCache;
> + bounds = (char *)obj - (char *)chunk->objCache;
> if (bounds < 0)
> return -1;
> if (bounds < lastPool->chunk_size)

------------------------------------
 Andres Kroonmaa <andre@online.ee>
 CTO, Microlink Online
 Tel: 6501 731, Fax: 6501 725
 Pärnu mnt. 158, Tallinn,
 11317 Estonia
Received on Mon Apr 08 2002 - 00:57:18 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:14:58 MST