On Mon, Nov 5, 2018 at 2:14 PM Nikolay Sivov nsivov@codeweavers.com wrote:
I think it's better to introduce 'capacity' or 'nb_allocated' field, and use that instead of HeapSize().
Then you can have new array length aligned in one place, with heap_realloc() that will handle initial state of items == NULL.
I feel as if it's out of the scope of this (small) patch. That would require quite some changes since a lot of the other code also uses HeapSize().
Also, I'm probably misunderstanding something, but HeapSize is aligned already, though. It's just the current code which rounds up the size requested *without* looking at the available space. So it will always grow, even if there's plenty of free space.