b21e238037
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). Patch created mechanically with: $ spatch --in-place --sp-file scripts/coccinelle/use-g_new-etc.cocci \ --macro-file scripts/cocci-macro-file.h FILES... Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Cédric Le Goater <clg@kaod.org> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Message-Id: <20220315144156.1595462-4-armbru@redhat.com> Reviewed-by: Pavel Dovgalyuk <Pavel.Dovgalyuk@ispras.ru> |
||
---|---|---|
.. | ||
avr_usart.c | ||
bcm2835_aux.c | ||
cadence_uart.c | ||
cmsdk-apb-uart.c | ||
debugcon.c | ||
digic-uart.c | ||
escc.c | ||
etraxfs_ser.c | ||
exynos4210_uart.c | ||
goldfish_tty.c | ||
grlib_apbuart.c | ||
ibex_uart.c | ||
imx_serial.c | ||
ipoctal232.c | ||
Kconfig | ||
mcf_uart.c | ||
mchp_pfsoc_mmuart.c | ||
meson.build | ||
nrf51_uart.c | ||
omap_uart.c | ||
parallel-isa.c | ||
parallel.c | ||
pl011.c | ||
renesas_sci.c | ||
riscv_htif.c | ||
sclpconsole-lm.c | ||
sclpconsole.c | ||
serial-isa.c | ||
serial-pci-multi.c | ||
serial-pci.c | ||
serial.c | ||
sh_serial.c | ||
shakti_uart.c | ||
sifive_uart.c | ||
spapr_vty.c | ||
stm32f2xx_usart.c | ||
terminal3270.c | ||
trace-events | ||
trace.h | ||
virtio-console.c | ||
virtio-serial-bus.c | ||
xen_console.c | ||
xilinx_uartlite.c |