From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34082) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZbW2e-0007xY-QH for qemu-devel@nongnu.org; Mon, 14 Sep 2015 11:51:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZbW2a-0006F8-IO for qemu-devel@nongnu.org; Mon, 14 Sep 2015 11:51:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47575) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZbW2a-0006El-Cd for qemu-devel@nongnu.org; Mon, 14 Sep 2015 11:51:36 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id 11600461D9 for ; Mon, 14 Sep 2015 15:51:36 +0000 (UTC) References: <1442231491-23352-1-git-send-email-armbru@redhat.com> From: Eric Blake Message-ID: <55F6ED06.4050100@redhat.com> Date: Mon, 14 Sep 2015 09:51:34 -0600 MIME-Version: 1.0 In-Reply-To: <1442231491-23352-1-git-send-email-armbru@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="DFewMoON064g6E7cdloSOIU7hqtDjpHM8" Subject: Re: [Qemu-devel] [PATCH] migration: Use g_new() & friends where that makes obvious sense List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster , qemu-devel@nongnu.org Cc: amit.shah@redhat.com, quintela@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --DFewMoON064g6E7cdloSOIU7hqtDjpHM8 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 09/14/2015 05:51 AM, Markus Armbruster wrote: > 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. >=20 > This commit only touches allocations with size arguments of the form > sizeof(T). Same Coccinelle semantic patch as in commit b45c03f. >=20 > Signed-off-by: Markus Armbruster > --- > migration/migration.c | 2 +- > migration/qemu-file-buf.c | 2 +- > migration/qemu-file-stdio.c | 4 ++-- > migration/qemu-file-unix.c | 4 ++-- > migration/qemu-file.c | 2 +- > migration/rdma.c | 17 ++++++++--------- > migration/savevm.c | 12 ++++++------ > 7 files changed, 21 insertions(+), 22 deletions(-) Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --DFewMoON064g6E7cdloSOIU7hqtDjpHM8 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJV9u0HAAoJEKeha0olJ0NqXawH/RWWRdZH60OgB17yxWE2WR4C Sh3L5devd/bmy1JLSAC+P4RQWD13KL9ArR8RjvLZKoOX9wpvFTXhZ4JgWD924/4o lYD9+FUPXbKHxZ5vc+ztbtFmkdALDPkrng9LAZOLfSfg8JXYf7/3ULxTrQvRyfkO lfbbjAlMTmw9dZLfUL6IEL83X+HuI+5z4f4KivJ4WpSFoNIQb/YlbeLfpFZ2KCoW BlePmbVnur5wkACkf0TQ0JguEmKX0dh7aauJb8Sz4I4UyL96MSVl2w39XibpDvOM s7TpkSi/1ZHSctgg2v31+ka0ldaHJlM3cqTJQUhVN9k7rkXY8/pPe3ZlTLHd5Yo= =U4Wp -----END PGP SIGNATURE----- --DFewMoON064g6E7cdloSOIU7hqtDjpHM8--