Rémi Bernon (@rbernon) commented about dlls/ntdll/heap.c:
+ return index * BLOCK_ALIGN; + + return ( ( log + linear ) << ( ( index >> FREE_LIST_LINEAR_BITS ) - 1 ) ) * BLOCK_ALIGN; +} + +/* locate a free list entry of the appropriate size */ +/* size is the size of the whole block including the arena header */ +static inline struct entry *find_free_list( struct heap *heap, SIZE_T block_size, BOOL last ) +{ + unsigned long block = get_free_list_block( block_size ); + + if ( last && ++block == NB_FREE_LISTS ) + block = 0; + + return &heap->free_lists[block]; }
/* locate a free list entry of the appropriate size */
static inline struct entry *find_free_list( struct heap *heap, SIZE_T block_size, BOOL last )
{
UINT index = get_free_list_index( block_size );
if (last && ++index == FREE_LIST_COUNT) index = 0;
return &heap->free_lists[index];
}
I think we can remove the block_size comments at this point, `block_size` is used consistently now and implies that the size includes the block header. I'd also prefer to use "index" rather than "block" which already has a different meaning. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/2622#note_29531