[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-trivial] [PATCH 34/88] qapi: use g_new() family of functions
From: |
Eric Blake |
Subject: |
Re: [Qemu-trivial] [PATCH 34/88] qapi: use g_new() family of functions |
Date: |
Mon, 9 Oct 2017 12:59:31 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 |
On 10/06/2017 06:49 PM, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
> ---
> qapi/opts-visitor.c | 2 +-
> qapi/qapi-clone-visitor.c | 2 +-
> qapi/qapi-dealloc-visitor.c | 2 +-
> qapi/qobject-output-visitor.c | 2 +-
> qapi/string-input-visitor.c | 2 +-
> qapi/string-output-visitor.c | 2 +-
> 6 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/qapi/opts-visitor.c b/qapi/opts-visitor.c
> index 324b197495..34ac49f3c2 100644
> --- a/qapi/opts-visitor.c
> +++ b/qapi/opts-visitor.c
> @@ -539,7 +539,7 @@ opts_visitor_new(const QemuOpts *opts)
> OptsVisitor *ov;
>
> assert(opts);
> - ov = g_malloc0(sizeof *ov);
> + ov = g_new0(OptsVisitor, 1);
Transformations like this are harder to justify - you have more typing
rather than less, and no change in the amount of type-safety.
If we really want to convert LHS = g_malloc0(sizeof(*LHS)), we probably
ought to have a stronger justification (consistency might be such an
argument, if the entire series is applied and HACKING is updated to
mention our new preferred style, and where the checked-in Coccinelle
script can be easily re-run in the future to catch regressions).
Converting LHS = g_malloc0(sizeof(type)) is a no-brainer, because it
DOES add type-safety, and often results in less typing. But I haven't
looked at your entire series to see which patches fall in the no-brainer
category vs. the weakly-argued consistency category.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature
- [Qemu-trivial] [PATCH 27/88] SH4: use g_new() family of functions, (continued)
- [Qemu-trivial] [PATCH 27/88] SH4: use g_new() family of functions, Philippe Mathieu-Daudé, 2017/10/06
- [Qemu-trivial] [PATCH 29/88] SPARC: use g_new() family of functions, Philippe Mathieu-Daudé, 2017/10/06
- [Qemu-trivial] [PATCH 30/88] QEMU Guest Agent: use g_new() family of functions, Philippe Mathieu-Daudé, 2017/10/06
- [Qemu-trivial] [PATCH 32/88] QObject: use g_new() family of functions, Philippe Mathieu-Daudé, 2017/10/06
- [Qemu-trivial] [PATCH 31/88] QMP: use g_new() family of functions, Philippe Mathieu-Daudé, 2017/10/06
- [Qemu-trivial] [PATCH 33/88] qom: use g_new() family of functions, Philippe Mathieu-Daudé, 2017/10/06
- [Qemu-trivial] [PATCH 34/88] qapi: use g_new() family of functions, Philippe Mathieu-Daudé, 2017/10/06
- Re: [Qemu-trivial] [PATCH 34/88] qapi: use g_new() family of functions,
Eric Blake <=
- [Qemu-trivial] [PATCH 35/88] Record/replay: use g_new() family of functions, Philippe Mathieu-Daudé, 2017/10/06
- [Qemu-trivial] [PATCH 36/88] SLIRP: use g_new() family of functions, Philippe Mathieu-Daudé, 2017/10/06
- [Qemu-trivial] [PATCH 37/88] TCG: use g_new() family of functions, Philippe Mathieu-Daudé, 2017/10/06
- [Qemu-trivial] [PATCH 38/88] VFIO: use g_new() family of functions, Philippe Mathieu-Daudé, 2017/10/06
- [Qemu-trivial] [PATCH 39/88] hw/i386: use g_new() family of functions, Philippe Mathieu-Daudé, 2017/10/06
- [Qemu-trivial] [PATCH 40/88] hw/xen: use g_new() family of functions, Philippe Mathieu-Daudé, 2017/10/06
- [Qemu-trivial] [PATCH 42/88] XTFPGA: use g_new() family of functions, Philippe Mathieu-Daudé, 2017/10/06
- [Qemu-trivial] [PATCH 41/88] target/i386: use g_new() family of functions, Philippe Mathieu-Daudé, 2017/10/06