From: Stefan Hajnoczi <stefanha@redhat.com>
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
Anthony Liguori <aliguori@amazon.com>
Subject: [Qemu-devel] [PULL 1/4] net: Use g_strdup_printf instead of snprintf.
Date: Mon, 27 Jan 2014 15:48:46 +0100 [thread overview]
Message-ID: <1390834129-19625-2-git-send-email-stefanha@redhat.com> (raw)
In-Reply-To: <1390834129-19625-1-git-send-email-stefanha@redhat.com>
From: Hani Benhabiles <kroosec@gmail.com>
assign_name() in net/net.c is using snprintf + g_strdup to get the same
result as g_strdup_printf.
Signed-off-by: Hani Benhabiles <kroosec@gmail.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
net/net.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/net/net.c b/net/net.c
index f8db85f..2c3af20 100644
--- a/net/net.c
+++ b/net/net.c
@@ -164,7 +164,6 @@ void qemu_macaddr_default_if_unset(MACAddr *macaddr)
static char *assign_name(NetClientState *nc1, const char *model)
{
NetClientState *nc;
- char buf[256];
int id = 0;
QTAILQ_FOREACH(nc, &net_clients, next) {
@@ -176,9 +175,7 @@ static char *assign_name(NetClientState *nc1, const char *model)
}
}
- snprintf(buf, sizeof(buf), "%s.%d", model, id);
-
- return g_strdup(buf);
+ return g_strdup_printf("%s.%d", model, id);
}
static void qemu_net_client_destructor(NetClientState *nc)
--
1.8.4.2
next prev parent reply other threads:[~2014-01-27 14:49 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-27 14:48 [Qemu-devel] [PULL 0/4] Net patches Stefan Hajnoczi
2014-01-27 14:48 ` Stefan Hajnoczi [this message]
2014-01-27 14:48 ` [Qemu-devel] [PULL 2/4] Fix lan9118 TX "CMD A" handling Stefan Hajnoczi
2014-01-27 14:48 ` [Qemu-devel] [PULL 3/4] Fix lan9118 buffer length handling Stefan Hajnoczi
2014-01-27 14:48 ` [Qemu-devel] [PULL 4/4] tap-linux: Get features once and use it many times Stefan Hajnoczi
2014-01-31 0:09 ` [Qemu-devel] [PULL 0/4] Net patches Peter Maydell
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=1390834129-19625-2-git-send-email-stefanha@redhat.com \
--to=stefanha@redhat.com \
--cc=aliguori@amazon.com \
--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).