提交 d2cffe30 编写于 作者: M Mark McLoughlin 提交者: Anthony Liguori

Move memset() from net_client_uninit() to net_client_init()

zeroing a structure before using it is more common than zeroing after
using it. Also makes the setting of nd->used more obvious.
Signed-off-by: NMark McLoughlin <markmc@redhat.com>
Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
上级 9203f520
......@@ -2443,6 +2443,7 @@ int net_client_init(Monitor *mon, const char *device, const char *p)
goto out;
}
nd = &nd_table[idx];
memset(nd, 0, sizeof(*nd));
macaddr = nd->macaddr;
macaddr[0] = 0x52;
macaddr[1] = 0x54;
......@@ -2818,7 +2819,7 @@ void net_client_uninit(NICInfo *nd)
qemu_free(nd->devaddr);
qemu_free(nd->id);
memset(nd, 0, sizeof(*nd));
nd->used = 0;
}
static int net_host_check_device(const char *device)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册