Vladimir Sementsov-Ogievskiy <vsement...@virtuozzo.com> writes: > 24.06.2020 19:43, Markus Armbruster wrote: >> There is just one use so far. The next commit will add more. >> >> Signed-off-by: Markus Armbruster <arm...@redhat.com> >> --- >> util/qemu-option.c | 27 ++++++++++++++++++--------- >> 1 file changed, 18 insertions(+), 9 deletions(-) >> >> diff --git a/util/qemu-option.c b/util/qemu-option.c >> index d9293814b4..3cdf0c0800 100644 >> --- a/util/qemu-option.c >> +++ b/util/qemu-option.c >> @@ -502,6 +502,23 @@ int qemu_opt_unset(QemuOpts *opts, const char *name) >> } >> } >> +static QemuOpt *opt_create(QemuOpts *opts, const char *name, char >> *value, >> + bool prepend) >> +{ >> + QemuOpt *opt = g_malloc0(sizeof(*opt)); > > I'd prefer g_new0(QemuOpt, 1)
I generally prefer g_new0() over g_malloc0(), too. But the pattern lhs = g_malloc0(sizeof(*lhs)) is fine with me, provided sizeof(*lhs) is at least as readable as the type of *lhs. Looks like a wash here, so I'm refraining from messing with the moved code. > anyway: > Reviewed-by: Vladimir Sementsov-Ogievskiy <vsement...@virtuozzo.com> Thanks!