Module: wine Branch: master Commit: 4c3cc858f87aaaf4d3e6f0809ab09a520f8da37d URL: https://source.winehq.org/git/wine.git/?a=commit;h=4c3cc858f87aaaf4d3e6f0809...
Author: Rémi Bernon rbernon@codeweavers.com Date: Wed May 4 16:08:44 2022 +0200
ntdll: Store the block size directly in block headers.
Signed-off-by: Rémi Bernon rbernon@codeweavers.com
---
dlls/ntdll/heap.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/dlls/ntdll/heap.c b/dlls/ntdll/heap.c index ac0f14646c4..1b6337d4ce8 100644 --- a/dlls/ntdll/heap.c +++ b/dlls/ntdll/heap.c @@ -253,17 +253,11 @@ static inline UINT block_get_overhead( const struct block *block ) /* return the size of a block, including its header */ static inline UINT block_get_size( const struct block *block ) { - UINT data_size = block->size & ARENA_SIZE_MASK, size = data_size; - if (block_get_flags( block ) & ARENA_FLAG_FREE) size += sizeof(struct entry); - else size += sizeof(*block); - if (size < data_size) return ~0u; - return size; + return block->size & ARENA_SIZE_MASK; }
static inline void block_set_size( struct block *block, UINT flags, UINT block_size ) { - if (flags & ARENA_FLAG_FREE) block_size -= sizeof(struct entry); - else block_size -= sizeof(*block); block->size = (block_size & ARENA_SIZE_MASK) | (flags & ~ARENA_SIZE_MASK); }