qemu-e2k/hw/misc
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
..
macio macio: remove nonexistent interrupt on pin 1 2015-07-07 17:44:49 +02:00
a9scu.c
applesmc.c pc: export applesmc IO port/len 2015-03-01 12:33:22 +01:00
arm11scu.c
arm_integrator_debug.c
arm_l2x0.c
arm_sysctl.c
cbus.c
debugexit.c
eccmemctl.c
edu.c misc: Fix new collection of typos 2015-04-30 16:05:48 +03:00
exynos4210_pmu.c
imx_ccm.c i.MX: Fix Coding style for CCM emulator 2015-08-13 11:26:20 +01:00
ivshmem.c Include qapi/qmp/qerror.h exactly where needed 2015-06-22 18:20:41 +02:00
Makefile.objs stm32f2xx_SYSCFG: Add the stm32f2xx SYSCFG 2015-03-11 13:21:05 +00:00
max111x.c
milkymist-hpdmc.c
milkymist-pfpu.c milkymist-pfpu: fix GCC 5.0.0 aggressive-loop-optimizations warning 2015-03-10 08:15:34 +03:00
mst_fpga.c
omap_clk.c arm: Use g_new() & friends where that makes obvious sense 2015-09-07 10:39:27 +01:00
omap_gpmc.c arm: Use g_new() & friends where that makes obvious sense 2015-09-07 10:39:27 +01:00
omap_l4.c omap: Fix warnings from Sparse 2015-03-19 11:11:55 +03:00
omap_sdrc.c arm: Use g_new() & friends where that makes obvious sense 2015-09-07 10:39:27 +01:00
omap_tap.c omap: Fix warnings from Sparse 2015-03-19 11:11:55 +03:00
pc-testdev.c
pci-testdev.c pci: Trivial device model conversions to realize 2015-02-26 12:42:16 +01:00
puv3_pm.c
pvpanic.c
sga.c
slavio_misc.c sun4m: fix slavio sysctrl and led register sizes 2015-04-27 18:24:18 +02:00
stm32f2xx_syscfg.c stm32f2xx_SYSCFG: Add the stm32f2xx SYSCFG 2015-03-11 13:21:05 +00:00
tmp105.c
tmp105.h
vmport.c
zynq_slcr.c