[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 14/46] qemu-option: Factor out helper opt_create()
From: |
Markus Armbruster |
Subject: |
Re: [PATCH 14/46] qemu-option: Factor out helper opt_create() |
Date: |
Wed, 01 Jul 2020 10:13:05 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) |
Vladimir Sementsov-Ogievskiy <vsementsov@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 <armbru@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 <vsementsov@virtuozzo.com>
Thanks!
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [PATCH 14/46] qemu-option: Factor out helper opt_create(),
Markus Armbruster <=