On Mon Feb 6 15:54:47 2023 +0000, Jinoh Kang wrote:
`heap_resize_block` is already too complex. How about factoring this out into a following helper function?
/* Finish resizing a block of memory and re-initialize it. */ static void commit_block_resize( struct block *block, SIZE_T old_size, SIZE_T size, DWORD flags ) { valgrind_notify_resize( block + 1, old_size, size ); block_set_flags( block, BLOCK_FLAG_USER_MASK & ~BLOCK_FLAG_USER_INFO, BLOCK_USER_FLAGS( flags ) ); block->tail_size = block_get_size( block ) - sizeof(*block) - size; initialize_block( block, old_size, size, flags ); mark_block_tail( block, flags ); }
Feel free to rename it if the "commit" part feels like it will be easily confused with virtual memory commitment.
Yeah I guess it could be split first. Then I think each block type has a bit of specifics right now so I'm not going to factor things yet, and I'll only follow the other helpers naming.