diff options
author | Alexis211 <alexis211@gmail.com> | 2010-04-05 16:56:17 +0200 |
---|---|---|
committer | Alexis211 <alexis211@gmail.com> | 2010-04-05 16:56:17 +0200 |
commit | 8d94ae49601e0e4023bcdc35191669b2c24f6c96 (patch) | |
tree | 64d625ee6aa5a897666be2768d009b2353ba97d9 /src/library/gc/shm.c | |
parent | b945eafa126d6a17aa8826a405df7d5d4d999008 (diff) | |
download | TCE-8d94ae49601e0e4023bcdc35191669b2c24f6c96.tar.gz TCE-8d94ae49601e0e4023bcdc35191669b2c24f6c96.zip |
More work on IPC.
Diffstat (limited to 'src/library/gc/shm.c')
-rw-r--r-- | src/library/gc/shm.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/library/gc/shm.c b/src/library/gc/shm.c index 9e19533..8077352 100644 --- a/src/library/gc/shm.c +++ b/src/library/gc/shm.c @@ -26,10 +26,10 @@ void* shm_alloc(size_t size) { if (blocks == 0) shm_init(); if (size & 0xFFF) size = (size & 0xFFFFF000) + 0x1000; //go through all blocks, get the one with the closest size - struct shm_block *block = blocks; - while (block) { - if (block->size >= size) break; - block = block->next; + struct shm_block *i = blocks, *block = 0; + while (i) { + if (i->size >= size && i->is_hole == 1 && i->size < block->size) block = i; + i = i->next; } if (block == 0) { mutex_unlock(&tMutex); |