[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH experiment 06/16] use g_new0 instead of g_malloc0
From: |
Markus Armbruster |
Subject: |
Re: [PATCH experiment 06/16] use g_new0 instead of g_malloc0 |
Date: |
Mon, 14 Mar 2022 12:16:46 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) |
Paolo Bonzini <pbonzini@redhat.com> writes:
> Casting to/from void* must be explicit in C++. g_new0 takes care of that.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> include/qemu/timer.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/qemu/timer.h b/include/qemu/timer.h
> index 88ef114689..ee071e07d1 100644
> --- a/include/qemu/timer.h
> +++ b/include/qemu/timer.h
> @@ -520,7 +520,7 @@ static inline QEMUTimer
> *timer_new_full(QEMUTimerListGroup *timer_list_group,
> int scale, int attributes,
> QEMUTimerCB *cb, void *opaque)
> {
> - QEMUTimer *ts = g_malloc0(sizeof(QEMUTimer));
> + QEMUTimer *ts = g_new0(QEMUTimer, 1);
> timer_init_full(ts, timer_list_group, type, scale, attributes, cb,
> opaque);
> return ts;
> }
Looks like a rerun of commit b45c03f585's Coccinelle script is due.
I'll take care of it.
- [PATCH experiment 13/16] disable some code, (continued)
- [PATCH experiment 13/16] disable some code, Paolo Bonzini, 2022/03/14
- [PATCH experiment 12/16] remove "new" keyword from trace-events, Paolo Bonzini, 2022/03/14
- [PATCH experiment 16/16] port test-coroutine to C++ coroutines, Paolo Bonzini, 2022/03/14
- [PATCH experiment 14/16] util: introduce C++ stackless coroutine backend, Paolo Bonzini, 2022/03/14
- [PATCH experiment 10/16] add space between liter and string macro, Paolo Bonzini, 2022/03/14
- [PATCH experiment 04/16] coroutine: introduce QemuCoLockable, Paolo Bonzini, 2022/03/14
- [PATCH experiment 06/16] use g_new0 instead of g_malloc0, Paolo Bonzini, 2022/03/14
- Re: [PATCH experiment 06/16] use g_new0 instead of g_malloc0,
Markus Armbruster <=
- [PATCH experiment 08/16] tracetool: add extern "C" around generated headers, Paolo Bonzini, 2022/03/14
- [PATCH experiment 09/16] start adding extern "C" markers, Paolo Bonzini, 2022/03/14
- [PATCH experiment 11/16] bump to C++20, Paolo Bonzini, 2022/03/14
- [PATCH experiment 15/16] port QemuCoLockable to C++ coroutines, Paolo Bonzini, 2022/03/14
- Re: [PATCH experiment 00/16] C++20 coroutine backend, Stefan Hajnoczi, 2022/03/14