qemu-e2k/hw/input
Markus Armbruster b45c03f585 arm: Use g_new() & friends where that makes obvious sense
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).

Coccinelle semantic patch:

    @@
    type T;
    @@
    -g_malloc(sizeof(T))
    +g_new(T, 1)
    @@
    type T;
    @@
    -g_try_malloc(sizeof(T))
    +g_try_new(T, 1)
    @@
    type T;
    @@
    -g_malloc0(sizeof(T))
    +g_new0(T, 1)
    @@
    type T;
    @@
    -g_try_malloc0(sizeof(T))
    +g_try_new0(T, 1)
    @@
    type T;
    expression n;
    @@
    -g_malloc(sizeof(T) * (n))
    +g_new(T, n)
    @@
    type T;
    expression n;
    @@
    -g_try_malloc(sizeof(T) * (n))
    +g_try_new(T, n)
    @@
    type T;
    expression n;
    @@
    -g_malloc0(sizeof(T) * (n))
    +g_new0(T, n)
    @@
    type T;
    expression n;
    @@
    -g_try_malloc0(sizeof(T) * (n))
    +g_try_new0(T, n)
    @@
    type T;
    expression p, n;
    @@
    -g_realloc(p, sizeof(T) * (n))
    +g_renew(T, p, n)
    @@
    type T;
    expression p, n;
    @@
    -g_try_realloc(p, sizeof(T) * (n))
    +g_try_renew(T, p, n)
    @@
    type T;
    expression n;
    @@
    -(T *)g_new(T, n)
    +g_new(T, n)
    @@
    type T;
    expression n;
    @@
    -(T *)g_new0(T, n)
    +g_new0(T, n)
    @@
    type T;
    expression p, n;
    @@
    -(T *)g_renew(T, p, n)
    +g_renew(T, p, n)

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 1440524394-15640-1-git-send-email-armbru@redhat.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-09-07 10:39:27 +01:00
..
Makefile.objs virtio-input: evdev passthrough 2015-06-23 10:32:35 +02:00
adb.c adb.c: include ADBDevice parent state in KBDState and MouseState 2015-03-09 15:00:04 +01:00
hid.c hid: clarify hid_keyboard_process_keycode 2015-07-17 08:44:41 +02:00
lm832x.c vmstate: accept QEMUTimer in VMSTATE_TIMER*, add VMSTATE_TIMER_PTR* 2015-01-26 12:22:44 +01:00
milkymist-softusb.c milkymist: softmmu: fix event handling 2014-12-29 17:24:38 +01:00
pckbd.c migration: Use normal VMStateDescriptions for Subsections 2015-06-12 06:53:57 +02:00
pl050.c pl050: QOM'ify pl050_keyboard and pl050_mouse 2013-07-29 21:06:57 +02:00
ps2.c migration: Use normal VMStateDescriptions for Subsections 2015-06-12 06:53:57 +02:00
pxa2xx_keypad.c savevm: Remove all the unneeded version_minimum_id_old (arm) 2014-05-13 16:09:35 +01:00
stellaris_input.c arm: Use g_new() & friends where that makes obvious sense 2015-09-07 10:39:27 +01:00
tsc210x.c hw/input/tsc210x.c: Delete unused array tsc2101_rates 2014-09-29 18:48:48 +01:00
tsc2005.c aio / timers: Switch entire codebase to the new timer API 2013-08-22 19:14:24 +02:00
virtio-input-hid.c virtio-input: fix segfault in virtio_input_hid_properties 2015-07-16 17:34:41 +02:00
virtio-input-host.c virtio-input: move sys/ioctl.h include 2015-07-16 17:34:41 +02:00
virtio-input.c virtio: get_features() can fail 2015-07-27 18:11:53 +03:00
vmmouse.c savevm: Remove all the unneeded version_minimum_id_old (x86) 2014-06-16 04:55:26 +02:00