提交 4bf2c138 编写于 作者: H Hani Benhabiles 提交者: Stefan Hajnoczi

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: NHani Benhabiles <kroosec@gmail.com>
Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
上级 0169c511
......@@ -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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册