aboutsummaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorHani Benhabiles <kroosec@gmail.com>2014-01-09 19:34:27 +0100
committerStefan Hajnoczi <stefanha@redhat.com>2014-01-27 15:44:06 +0100
commit4bf2c138ddefc6ff17f6c4b947320c60aa0c38a0 (patch)
tree92720482ef1f706c07efc2c1f031cfbd5a87847c /net
parent0169c511554cb0014a00290b0d3d26c31a49818f (diff)
net: Use g_strdup_printf instead of snprintf.
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>
Diffstat (limited to 'net')
-rw-r--r--net/net.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/net/net.c b/net/net.c
index f8db85f30b..2c3af202a6 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)