/*
- * $Id: MemPool.c,v 1.7 2002/04/06 08:49:26 adrian Exp $
+ * $Id: MemPool.c,v 1.8 2002/04/06 15:06:13 hno Exp $
*
* DEBUG: section 63 Low Level Memory Pool Management
* AUTHOR: Alex Rousskov, Andres Kroonmaa
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;
}
/* Compare object to chunk */
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)
Free = chunk->freeList = chunk->objCache;
for (i = 1; i < pool->chunk_capacity; i++) {
- *Free = (void *) Free + pool->obj_size;
+ *Free = (void *) ((char *)Free + pool->obj_size);
Free = *Free;
}
chunk->nextFreeChunk = pool->nextFreeChunk;