qemu-e2k/hw
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
..
9pfs virtio: get_features() can fail 2015-07-27 18:11:53 +03:00
acpi hw/acpi/ich9: clean up stale comment about KVM not supporting SMM 2015-07-27 22:44:47 +03:00
alpha
arm arm: Use g_new() & friends where that makes obvious sense 2015-09-07 10:39:27 +01:00
audio
block virtio-blk-dataplane: delete bottom half before the AioContext is freed 2015-07-29 10:02:06 +01:00
bt
char arm: Use g_new() & friends where that makes obvious sense 2015-09-07 10:39:27 +01:00
core
cpu hw/cpu/a15mpcore: Wire up hyp and secure physical timer interrupts 2015-08-13 11:26:22 +01:00
cris
display arm: Use g_new() & friends where that makes obvious sense 2015-09-07 10:39:27 +01:00
dma arm: Use g_new() & friends where that makes obvious sense 2015-09-07 10:39:27 +01:00
gpio arm: Use g_new() & friends where that makes obvious sense 2015-09-07 10:39:27 +01:00
i2c
i386 smbios: move smbios code into a common folder 2015-08-13 14:08:30 +03:00
ide Fix release_drive on unplugged devices (pci_piix3_xen_ide_unplug) 2015-08-03 14:27:12 +00:00
input arm: Use g_new() & friends where that makes obvious sense 2015-09-07 10:39:27 +01:00
intc hw/arm/gic: Kill code duplication 2015-08-13 11:26:21 +01:00
ipack
isa
lm32
m68k
mem
microblaze
mips
misc arm: Use g_new() & friends where that makes obvious sense 2015-09-07 10:39:27 +01:00
moxie
net ne2000: Drop ne2000_can_receive 2015-09-02 14:51:07 +01:00
nvram
openrisc
pci pci: allow 0 address for PCI IO/MEM regions 2015-08-13 14:08:29 +03:00
pci-bridge
pci-host MIPS patches 2015-08-13 2015-08-13 17:47:44 +01:00
pcmcia
ppc pci: allow 0 address for PCI IO/MEM regions 2015-08-13 14:08:29 +03:00
s390x s390x: Disable storage key migration on old machine type 2015-09-03 12:17:54 +02:00
scsi scsi-generic: identify AIO callbacks more clearly 2015-08-14 23:40:32 +02:00
sd arm: Use g_new() & friends where that makes obvious sense 2015-09-07 10:39:27 +01:00
sh4
smbios smbios: move smbios code into a common folder 2015-08-13 14:08:30 +03:00
sparc
sparc64
ssi arm: Use g_new() & friends where that makes obvious sense 2015-09-07 10:39:27 +01:00
timer arm: Use g_new() & friends where that makes obvious sense 2015-09-07 10:39:27 +01:00
tpm
tricore
unicore32
usb usbnet: Drop usbnet_can_receive 2015-07-27 14:12:18 +01:00
vfio vfio/pci: Fix bootindex 2015-07-22 14:56:01 -06:00
virtio virtio: fix 1.0 virtqueue migration 2015-08-05 16:56:34 +03:00
watchdog watchdog/diag288: correctly register for system reset requests 2015-07-14 19:10:03 +02:00
xen
xenpv
xtensa
Makefile.objs smbios: move smbios code into a common folder 2015-08-13 14:08:30 +03:00