From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46321) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1drmIT-0006VV-JT for qemu-devel@nongnu.org; Tue, 12 Sep 2017 10:36:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1drmIQ-0003WU-Gu for qemu-devel@nongnu.org; Tue, 12 Sep 2017 10:36:17 -0400 Received: from smtp.ctxuk.citrix.com ([185.25.65.24]:23936 helo=SMTP.EU.CITRIX.COM) by eggs.gnu.org with esmtps (TLS1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.71) (envelope-from ) id 1drmIQ-0003Sh-6M for qemu-devel@nongnu.org; Tue, 12 Sep 2017 10:36:14 -0400 From: Paul Durrant Date: Tue, 12 Sep 2017 14:33:32 +0000 Message-ID: References: <59B80A35020000780017A344@prv-mh.provo.novell.com> <59B80A35020000780017A344@prv-mh.provo.novell.com> In-Reply-To: <59B80A35020000780017A344@prv-mh.provo.novell.com> Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] xen_disk: avoid use of g_malloc0_n() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: 'Jan Beulich' , "qemu-devel@nongnu.org" Cc: Stefano Stabellini , xen-devel > -----Original Message----- > From: Jan Beulich [mailto:JBeulich@suse.com] > Sent: 12 September 2017 07:24 > To: qemu-devel@nongnu.org > Cc: Paul Durrant ; Stefano Stabellini > ; xen-devel > Subject: [PATCH] xen_disk: avoid use of g_malloc0_n() >=20 > Prefer g_new() / g_new0() to be farther backwards compatible with older > glib versions. As there's no point in zeroing the allocation here (the > loop right afterwards fully initializes the memory), use the former. >=20 > Signed-off-by: Jan Beulich Reviewed-by: Paul Durrant >=20 > --- a/hw/block/xen_disk.c > +++ b/hw/block/xen_disk.c > @@ -1232,7 +1232,7 @@ static int blk_connect(struct XenDevice > return -1; > } >=20 > - domids =3D g_malloc0_n(blkdev->nr_ring_ref, sizeof(uint32_t)); > + domids =3D g_new(uint32_t, blkdev->nr_ring_ref); > for (i =3D 0; i < blkdev->nr_ring_ref; i++) { > domids[i] =3D blkdev->xendev.dom; > } >=20 >=20