diff options
| author | Markus Armbruster | 2014-12-04 15:00:03 +0100 |
|---|---|---|
| committer | Michael Tokarev | 2014-12-10 09:34:15 +0100 |
| commit | e1cf5582644ef63528993fb2b88dd3b43b9914c6 (patch) | |
| tree | 003ca1aa1cb4dab97435244da51b25c6ee8de482 /scripts | |
| parent | util: Fuse g_malloc(); memset() into g_new0() (diff) | |
| download | qemu-e1cf5582644ef63528993fb2b88dd3b43b9914c6.tar.gz qemu-e1cf5582644ef63528993fb2b88dd3b43b9914c6.tar.xz qemu-e1cf5582644ef63528993fb2b88dd3b43b9914c6.zip | |
util: 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: Michael Tokarev <mjt@tls.msk.ru>
Diffstat (limited to 'scripts')
0 files changed, 0 insertions, 0 deletions
