]> git.proxmox.com Git - mirror_qemu.git/commit
scsi: Use g_new() & friends where that makes obvious sense
authorMarkus Armbruster <armbru@redhat.com>
Thu, 4 Dec 2014 13:12:45 +0000 (14:12 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 15 Dec 2014 11:21:02 +0000 (12:21 +0100)
commit3c55fe2a13353b3ddf1db51c34ada23d161ee428
treed74ed4655f03dc3dd98d1e1e3becc8edc83d6c72
parent0bd0adbe5b438cabbf02230dba1be4c209158f57
scsi: 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).

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
hw/scsi/lsi53c895a.c
hw/scsi/virtio-scsi.c