diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2021-04-20 12:16:43 +0200 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2021-04-20 12:16:43 +0200 |
| commit | 5520dae2e795dc9a2f38e7e6076a79dcac2b2e7f (patch) | |
| tree | c4b50fd00a88145c15825c3816440ea87a45f222 /src | |
| parent | 7a7f26c80ea058834aaeea149893164ae8ee08d3 (diff) | |
| download | box64-5520dae2e795dc9a2f38e7e6076a79dcac2b2e7f.tar.gz box64-5520dae2e795dc9a2f38e7e6076a79dcac2b2e7f.zip | |
Another small change to custommem MaxFreeblock handling
Diffstat (limited to 'src')
| -rw-r--r-- | src/custommem.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/custommem.c b/src/custommem.c index 80adb476..8bc25ac0 100644 --- a/src/custommem.c +++ b/src/custommem.c @@ -97,14 +97,12 @@ static size_t getMaxFreeBlock(void* block, size_t block_size) while(m->prev.x32) { // while there is a subblock if(!m->prev.fill && m->prev.size>maxsize) { maxsize = m->prev.size; - if(maxsize>sizeof(blockmark_t)) - maxsize -= sizeof(blockmark_t); if((uintptr_t)block+maxsize>(uintptr_t)m) - return maxsize; // no block large enough left... + return (maxsize>=sizeof(blockmark_t))?(maxsize-sizeof(blockmark_t)):0; // no block large enough left... } m = (blockmark_t*)((uintptr_t)m - m->prev.size); } - return maxsize; + return (maxsize>=sizeof(blockmark_t))?(maxsize-sizeof(blockmark_t)):0; } static void* allocBlock(void* block, void *sub, size_t size) |