From: Greg Kurz <groug@kaod.org>
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>, Greg Kurz <groug@kaod.org>
Subject: [Qemu-devel] [PULL 1/3] 9p: use g_new(T, n) instead of g_malloc(sizeof(T) * n)
Date: Thu, 13 Dec 2018 10:03:41 +0100 [thread overview]
Message-ID: <20181213090343.1137475-2-groug@kaod.org> (raw)
In-Reply-To: <20181213090343.1137475-1-groug@kaod.org>
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>
---
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) {
--
2.17.2
next prev parent reply other threads:[~2018-12-13 9:04 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-13 9:03 [Qemu-devel] [PULL 0/3] 9p patches 2018-12-13 Greg Kurz
2018-12-13 9:03 ` Greg Kurz [this message]
2018-12-13 9:03 ` [Qemu-devel] [PULL 2/3] xen/9pfs: use g_new(T, n) instead of g_malloc(sizeof(T) * n) Greg Kurz
2018-12-13 9:03 ` [Qemu-devel] [PULL 3/3] 9p: remove support for the "handle" backend Greg Kurz
2018-12-13 11:20 ` [Qemu-devel] [PULL 0/3] 9p patches 2018-12-13 no-reply
2018-12-13 12:04 ` Greg Kurz
2018-12-14 19:12 ` Peter Maydell
2018-12-15 18:44 ` Greg Kurz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181213090343.1137475-2-groug@kaod.org \
--to=groug@kaod.org \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).