* [Qemu-devel] [PATCH for 4.0 1/2] 9p: use g_new(T, n) instead of g_malloc(sizeof(T) * n)
@ 2018-11-29 15:47 Greg Kurz
2018-11-29 15:47 ` [Qemu-devel] [PATCH for 4.0 2/2] xen/9pfs: " Greg Kurz
2018-11-29 16:26 ` [Qemu-devel] [PATCH for 4.0 1/2] 9p: " Anthony PERARD
0 siblings, 2 replies; 5+ messages in thread
From: Greg Kurz @ 2018-11-29 15:47 UTC (permalink / raw)
To: qemu-devel; +Cc: Greg Kurz, Stefano Stabellini, Anthony Perard
Because it is a recommended coding practice (see HACKING).
Signed-off-by: Greg Kurz <groug@kaod.org>
---
hw/9pfs/9p.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
index bdf7919abfc5..55821343e594 100644
--- a/hw/9pfs/9p.c
+++ b/hw/9pfs/9p.c
@@ -1331,8 +1331,8 @@ static void coroutine_fn v9fs_walk(void *opaque)
trace_v9fs_walk(pdu->tag, pdu->id, fid, newfid, nwnames);
if (nwnames && nwnames <= P9_MAXWELEM) {
- wnames = g_malloc0(sizeof(wnames[0]) * nwnames);
- qids = g_malloc0(sizeof(qids[0]) * nwnames);
+ wnames = g_new0(V9fsString, nwnames);
+ qids = g_new0(V9fsQID, nwnames);
for (i = 0; i < nwnames; i++) {
err = pdu_unmarshal(pdu, offset, "s", &wnames[i]);
if (err < 0) {
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [Qemu-devel] [PATCH for 4.0 2/2] xen/9pfs: use g_new(T, n) instead of g_malloc(sizeof(T) * n)
2018-11-29 15:47 [Qemu-devel] [PATCH for 4.0 1/2] 9p: use g_new(T, n) instead of g_malloc(sizeof(T) * n) Greg Kurz
@ 2018-11-29 15:47 ` Greg Kurz
2018-11-29 16:16 ` Anthony PERARD
2018-11-29 16:26 ` [Qemu-devel] [PATCH for 4.0 1/2] 9p: " Anthony PERARD
1 sibling, 1 reply; 5+ messages in thread
From: Greg Kurz @ 2018-11-29 15:47 UTC (permalink / raw)
To: qemu-devel; +Cc: Greg Kurz, Stefano Stabellini, Anthony Perard
Because it is a recommended coding practice (see HACKING).
Signed-off-by: Greg Kurz <groug@kaod.org>
---
hw/9pfs/xen-9p-backend.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/hw/9pfs/xen-9p-backend.c b/hw/9pfs/xen-9p-backend.c
index 3f54a21c7623..9015fe7773d0 100644
--- a/hw/9pfs/xen-9p-backend.c
+++ b/hw/9pfs/xen-9p-backend.c
@@ -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;
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH for 4.0 2/2] xen/9pfs: use g_new(T, n) instead of g_malloc(sizeof(T) * n)
2018-11-29 15:47 ` [Qemu-devel] [PATCH for 4.0 2/2] xen/9pfs: " Greg Kurz
@ 2018-11-29 16:16 ` Anthony PERARD
0 siblings, 0 replies; 5+ messages in thread
From: Anthony PERARD @ 2018-11-29 16:16 UTC (permalink / raw)
To: Greg Kurz; +Cc: qemu-devel, Stefano Stabellini
On Thu, Nov 29, 2018 at 04:47:22PM +0100, Greg Kurz wrote:
> Because it is a recommended coding practice (see HACKING).
>
> Signed-off-by: Greg Kurz <groug@kaod.org>
Acked-by: Anthony PERARD <anthony.perard@citrix.com>
--
Anthony PERARD
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH for 4.0 1/2] 9p: use g_new(T, n) instead of g_malloc(sizeof(T) * n)
2018-11-29 15:47 [Qemu-devel] [PATCH for 4.0 1/2] 9p: use g_new(T, n) instead of g_malloc(sizeof(T) * n) Greg Kurz
2018-11-29 15:47 ` [Qemu-devel] [PATCH for 4.0 2/2] xen/9pfs: " Greg Kurz
@ 2018-11-29 16:26 ` Anthony PERARD
2018-11-29 16:38 ` Greg Kurz
1 sibling, 1 reply; 5+ messages in thread
From: Anthony PERARD @ 2018-11-29 16:26 UTC (permalink / raw)
To: Greg Kurz; +Cc: qemu-devel, Stefano Stabellini
On Thu, Nov 29, 2018 at 04:47:12PM +0100, Greg Kurz wrote:
> Because it is a recommended coding practice (see HACKING).
>
> Signed-off-by: Greg Kurz <groug@kaod.org>
Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
It would have been nice if there were a cover letter for these two
patches, as we would had automatic build test and coding style test ;-).
--
Anthony PERARD
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH for 4.0 1/2] 9p: use g_new(T, n) instead of g_malloc(sizeof(T) * n)
2018-11-29 16:26 ` [Qemu-devel] [PATCH for 4.0 1/2] 9p: " Anthony PERARD
@ 2018-11-29 16:38 ` Greg Kurz
0 siblings, 0 replies; 5+ messages in thread
From: Greg Kurz @ 2018-11-29 16:38 UTC (permalink / raw)
To: Anthony PERARD; +Cc: qemu-devel, Stefano Stabellini
On Thu, 29 Nov 2018 16:26:48 +0000
Anthony PERARD <anthony.perard@citrix.com> wrote:
> On Thu, Nov 29, 2018 at 04:47:12PM +0100, Greg Kurz wrote:
> > Because it is a recommended coding practice (see HACKING).
> >
> > Signed-off-by: Greg Kurz <groug@kaod.org>
>
> Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
>
> It would have been nice if there were a cover letter for these two
> patches, as we would had automatic build test and coding style test ;-).
>
Yeah... I had it ready and I simply forgot to pass it to stg mail :-\
I've pushed them to my 9p-next branch, which automatically triggers travis,
so I'll have the build test covered at least :)
Thanks for the review !
Cheers,
--
Greg
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-11-29 16:39 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-29 15:47 [Qemu-devel] [PATCH for 4.0 1/2] 9p: use g_new(T, n) instead of g_malloc(sizeof(T) * n) Greg Kurz
2018-11-29 15:47 ` [Qemu-devel] [PATCH for 4.0 2/2] xen/9pfs: " Greg Kurz
2018-11-29 16:16 ` Anthony PERARD
2018-11-29 16:26 ` [Qemu-devel] [PATCH for 4.0 1/2] 9p: " Anthony PERARD
2018-11-29 16:38 ` Greg Kurz
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.