[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 1/4] ui: Use g_new() & friends where that mak
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-devel] [PATCH v2 1/4] ui: Use g_new() & friends where that makes obvious sense |
Date: |
Tue, 03 Nov 2015 14:49:09 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
Michael Tokarev <address@hidden> writes:
> 29.10.2015 18:55, Markus Armbruster wrote:
>> g_new(T, n) is neater than g_malloc(sizeof(T) * n). It's also safer,
>> for two reasons. One, it catches multiplication overflowing size_t.
>> Two, it returns T * rather than void *, which lets the compiler catch
>> more type errors.
>>
>> This commit only touches allocations with size arguments of the form
>> sizeof(T). Same Coccinelle semantic patch as in commit b45c03f.
>>
>> Signed-off-by: Markus Armbruster <address@hidden>
>> Reviewed-by: Eric Blake <address@hidden>
>> ---
>> ui/console.c | 2 +-
>> ui/curses.c | 2 +-
>> ui/input-legacy.c | 4 ++--
>> ui/keymaps.c | 2 +-
>> ui/sdl.c | 2 +-
>> ui/vnc-jobs.c | 6 +++---
>> ui/vnc.c | 6 +++---
>> 7 files changed, 12 insertions(+), 12 deletions(-)
>
> ui/vnc.c code has been modified by Eric Blake meanwhile,
> in 2d32addae70987521578d8bb27c6b3f52cdcbdcb "sockets:
> Convert to new qapi union layout".
>
> The patch applies for other files however.
I can regenerate this patch easily. Would you be willing to replace it
in your tree by a v3?