qemu-e2k/hw/arm
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
..
allwinner-a10.c
armv7m.c
boot.c hw/arm/boot: Increase fdt alignment 2015-07-15 17:16:26 +01:00
collie.c
cubieboard.c arm: memory: Replace memory_region_init_ram with memory_region_allocate_system_memory 2015-04-08 17:30:36 +01:00
digic_boards.c arm: memory: Replace memory_region_init_ram with memory_region_allocate_system_memory 2015-04-08 17:30:36 +01:00
digic.c
exynos4_boards.c
exynos4210.c
gumstix.c
highbank.c hw/arm/highbank.c: Wire FIQ between CPU <> GIC 2015-05-12 11:57:19 +01:00
integratorcp.c arm: memory: Replace memory_region_init_ram with memory_region_allocate_system_memory 2015-04-08 17:30:36 +01:00
kzm.c i.MX: Split CCM emulator in a header file and a source file 2015-08-13 11:26:20 +01:00
mainstone.c
Makefile.objs hw/arm/sysbus-fdt: helpers for platform bus nodes addition 2015-06-02 15:44:28 +01:00
musicpal.c musicpal: Drop eth_can_receive 2015-07-20 17:47:24 +01:00
netduino2.c
nseries.c hw/arm/nseries.c: Fix misusing qemu_allocate_irqs for single irq 2015-06-03 14:21:24 +03:00
omap1.c arm: Use g_new() & friends where that makes obvious sense 2015-09-07 10:39:27 +01:00
omap2.c arm: Use g_new() & friends where that makes obvious sense 2015-09-07 10:39:27 +01:00
omap_sx1.c hw/arm/omap_sx1.c: Fix memory leak spotted by valgrind 2015-06-03 14:21:24 +03:00
palm.c
pxa2xx_gpio.c Convert (ffs(val) - 1) to ctz32(val) 2015-04-28 15:36:08 +02:00
pxa2xx_pic.c hw/arm/pxa2xx: Mark coprocessor registers as ARM_CP_IO 2015-06-15 18:06:09 +01:00
pxa2xx.c arm: Use g_new() & friends where that makes obvious sense 2015-09-07 10:39:27 +01:00
realview.c
spitz.c
stellaris.c arm: Use g_new() & friends where that makes obvious sense 2015-09-07 10:39:27 +01:00
stm32f205_soc.c
strongarm.c arm: Use g_new() & friends where that makes obvious sense 2015-09-07 10:39:27 +01:00
strongarm.h
sysbus-fdt.c hw/arm/sysbus-fdt: enable vfio-calxeda-xgmac dynamic instantiation 2015-06-19 14:17:44 +01:00
tosa.c
versatilepb.c arm: memory: Replace memory_region_init_ram with memory_region_allocate_system_memory 2015-04-08 17:30:36 +01:00
vexpress.c pflash_cfi01: change big-endian property to BIT type 2015-06-05 17:36:31 +02:00
virt-acpi-build.c hw/arm/virt-acpi-build: Add GICv2m description in ACPI MADT table 2015-06-26 14:22:36 +01:00
virt.c hw/arm/virt: Wire up secure timer interrupt 2015-08-13 11:26:22 +01:00
xilinx_zynq.c arm: memory: Replace memory_region_init_ram with memory_region_allocate_system_memory 2015-04-08 17:30:36 +01:00
xlnx-ep108.c arm: xlnx-zynqmp: Add boot-cpu property 2015-06-19 14:17:45 +01:00
xlnx-zynqmp.c xlnx-zynqmp: Connect the four OCM banks 2015-08-25 15:45:06 +01:00
z2.c