Skip to content
Snippets Groups Projects
Commit 75607e0d authored by Greg Kurz's avatar Greg Kurz
Browse files

xen/9pfs: use g_new(T, n) instead of g_malloc(sizeof(T) * n)


Because it is a recommended coding practice (see HACKING).

Signed-off-by: default avatarGreg Kurz <groug@kaod.org>
Acked-by: default avatarAnthony PERARD <anthony.perard@citrix.com>
parent 1923923b
No related branches found
No related tags found
No related merge requests found
......@@ -178,7 +178,7 @@ static void xen_9pfs_init_out_iov_from_pdu(V9fsPDU *pdu,
g_free(ring->sg);
ring->sg = g_malloc0(sizeof(*ring->sg) * 2);
ring->sg = g_new0(struct iovec, 2);
xen_9pfs_out_sg(ring, ring->sg, &num, pdu->idx);
*piov = ring->sg;
*pniov = num;
......@@ -196,7 +196,7 @@ static void xen_9pfs_init_in_iov_from_pdu(V9fsPDU *pdu,
g_free(ring->sg);
ring->sg = g_malloc0(sizeof(*ring->sg) * 2);
ring->sg = g_new0(struct iovec, 2);
xen_9pfs_in_sg(ring, ring->sg, &num, pdu->idx, size);
buf_size = iov_size(ring->sg, num);
......@@ -368,7 +368,7 @@ static int xen_9pfs_connect(struct XenDevice *xendev)
return -1;
}
xen_9pdev->rings = g_malloc0(xen_9pdev->num_rings * sizeof(Xen9pfsRing));
xen_9pdev->rings = g_new0(Xen9pfsRing, xen_9pdev->num_rings);
for (i = 0; i < xen_9pdev->num_rings; i++) {
char *str;
int ring_order;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment