qemu-e2k/hw/dma
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 hw: move DMA controllers to hw/dma/, configure with default-configs/ 2013-04-08 18:13:14 +02:00
etraxfs_dma.c memory: add owner argument to initialization functions 2013-07-04 17:42:44 +02:00
i8257.c hw/dma/i8257: Silence phony error message 2014-09-16 12:35:02 +02:00
i82374.c PortioList: Store PortioList in device state 2014-05-05 20:58:33 +02:00
omap_dma.c arm: Use g_new() & friends where that makes obvious sense 2015-09-07 10:39:27 +01:00
pl080.c Switch non-CPU callers from ld/st*_phys to address_space_ld/st* 2015-04-26 16:49:24 +01:00
pl330.c pl330.c: remove superfluous '\n' around error_setg 2015-03-10 08:15:33 +03:00
puv3_dma.c puv3_dma: QOM cast cleanup 2013-07-29 21:06:45 +02:00
pxa2xx_dma.c savevm: Remove all the unneeded version_minimum_id_old (arm) 2014-05-13 16:09:35 +01:00
rc4030.c dma/rc4030: convert to QOM 2015-06-11 10:13:29 +01:00
soc_dma.c aio / timers: Switch entire codebase to the new timer API 2013-08-22 19:14:24 +02:00
sparc32_dma.c savevm: Remove all the unneeded version_minimum_id_old (rest) 2014-05-14 15:24:51 +02:00
sun4m_iommu.c Switch non-CPU callers from ld/st*_phys to address_space_ld/st* 2015-04-26 16:49:24 +01:00
xilinx_axidma.c Include qapi/qmp/qerror.h exactly where needed 2015-06-22 18:20:41 +02:00