On 10/29/25 20:20, Peter Xu wrote:
On Wed, Oct 29, 2025 at 11:30:10AM +0100, BALATON Zoltan wrote:
memory_region_new_* will work, but I don't think removing unnecessary
but harmless fields from a device state structure does not sufficiently
motivates adding them.
I haven't given up on this yet, that's why I alternatively proposed
object_alloc (same as object_new without object_initialize)
memory_region_init
which is just a small change but should also work without adding
memory_region_new convenience functions. Then only object_alloc needs to be
added.
IMHO if this will ever happen, memory_region_new*() is better, unless
object_alloc() can be used anywhere besides MemoryRegion..
It seems to me, MemoryRegion is the only one I'm aware of that may need
such tweak, rather than using object_new() directly.
Yes, pretty much. Anyhow, leaking on purpose with g_new is not a good
idea. It's g_new, not g_leak; and everyone else is using a field in the
device structure so I don't see why one would want to do differently.
Paolo