Am 09.12.25 um 14:09 schrieb Daniel P. Berrangé:
g_malloc0_n should be used only in scenarios where you do NOT have a type
you can pass to g_new0. For example in the audio code
cap->buf = g_malloc0_n(hw->mix_buf.size, hw->info.bytes_per_frame);
any calls to g_malloc0_n which use sizeof(some-type) in an arg are
code style laws IMHO and should be changed to g_new0.
Or to put it another way. g_new0 must always be used/preferred except
in the handful of cases where it isn't possible.
There is another use of g_malloc0_n which might be replaced by g_new0 at
least in hw/9pfs/9p.c.
Regards,
Stefan