[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH] xen_disk: avoid use of g_malloc0_n()
> -----Original Message----- > From: Jan Beulich [mailto:JBeulich@xxxxxxxx] > Sent: 12 September 2017 07:24 > To: qemu-devel@xxxxxxxxxx > Cc: Paul Durrant <Paul.Durrant@xxxxxxxxxx>; Stefano Stabellini > <sstabellini@xxxxxxxxxx>; xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx> > Subject: [PATCH] xen_disk: avoid use of g_malloc0_n() > > 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. > > Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> Reviewed-by: Paul Durrant <paul.durrant@xxxxxxxxxx> > > --- a/hw/block/xen_disk.c > +++ b/hw/block/xen_disk.c > @@ -1232,7 +1232,7 @@ static int blk_connect(struct XenDevice > return -1; > } > > - domids = g_malloc0_n(blkdev->nr_ring_ref, sizeof(uint32_t)); > + domids = g_new(uint32_t, blkdev->nr_ring_ref); > for (i = 0; i < blkdev->nr_ring_ref; i++) { > domids[i] = blkdev->xendev.dom; > } > > _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |