diff vmalloc.c @ 125:9b2b9bc2c362

code cleaning
author Merten Sach <msach@mailbox.tu-berlin.de>
date Wed, 07 Sep 2011 14:28:20 +0200
parents e29bb31df078
children d0aa5a796fc5
line diff
     1.1 --- a/vmalloc.c	Tue Aug 30 17:45:14 2011 +0200
     1.2 +++ b/vmalloc.c	Wed Sep 07 14:28:20 2011 +0200
     1.3 @@ -96,7 +96,7 @@
     1.4     
     1.5     //The last element in the list points to the container. If the container points
     1.6     //to NULL the container is empty
     1.7 -   if(*((void**)(chunk->prevChunkInFreeList)) == NULL && getChunkSize(chunk) >= 160);
     1.8 +   if(*((void**)(chunk->prevChunkInFreeList)) == NULL && getChunkSize(chunk) >= BIG_LOWER_BOUND);
     1.9     {
    1.10         //Find the approppiate container because we do not know it
    1.11         uint64 containerIdx = ((uintptr_t)chunk->prevChunkInFreeList - (uintptr_t)freeLists->bigChunks) >> 3;
    1.12 @@ -183,7 +183,7 @@
    1.13      size_t chunkSize     = getChunkSize(foundChunk);
    1.14  
    1.15      //If the new chunk is larger than the requested size: split
    1.16 -    if(chunkSize > sizeRequested + 2 * sizeof(MallocProlog) + 160)
    1.17 +    if(chunkSize > sizeRequested + 2 * sizeof(MallocProlog) + BIG_LOWER_BOUND)
    1.18      {
    1.19         MallocProlog *newChunk = divideChunk(foundChunk,sizeRequested);
    1.20         containerIdx = getContainer(getChunkSize(foundChunk)) - 1;
    1.21 @@ -290,11 +290,11 @@
    1.22     }
    1.23     
    1.24     size_t chunkSize = getChunkSize(chunkToFree);
    1.25 -   if(chunkSize < 160)
    1.26 +   if(chunkSize < BIG_LOWER_BOUND)
    1.27     {
    1.28         containerIdx =  (chunkSize/SMALL_CHUNK_SIZE)-1;
    1.29 -       if(containerIdx > 3)
    1.30 -           containerIdx = 3;
    1.31 +       if(containerIdx > SMALL_CHUNK_COUNT-1)
    1.32 +           containerIdx = SMALL_CHUNK_COUNT-1;
    1.33         insertChunk(chunkToFree, &freeLists->smallChunks[containerIdx]);
    1.34     }
    1.35     else