]> git.proxmox.com Git - mirror_qemu.git/commit - migration/migration.c
migration: Use g_new() & friends where that makes obvious sense
authorMarkus Armbruster <armbru@redhat.com>
Mon, 14 Sep 2015 11:51:31 +0000 (13:51 +0200)
committerAmit Shah <amit.shah@redhat.com>
Tue, 29 Sep 2015 06:06:35 +0000 (11:36 +0530)
commit97f3ad35517e0d02c0149637d1bb10713c52b057
tree73f29aa9a4099bf48ceb0708bd1706fe6852b04d
parent56f3835ff1e70df97f843f4a27abdff6b4a2ae77
migration: 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).  Same Coccinelle semantic patch as in commit b45c03f.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <1442231491-23352-1-git-send-email-armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
Reviewed-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
migration/migration.c
migration/qemu-file-buf.c
migration/qemu-file-stdio.c
migration/qemu-file-unix.c
migration/qemu-file.c
migration/rdma.c
migration/savevm.c