[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-commits] [COMMIT d2cffe3] Move memset() from net_client_uninit() t
From: |
Anthony Liguori |
Subject: |
[Qemu-commits] [COMMIT d2cffe3] Move memset() from net_client_uninit() tonet_client_init() |
Date: |
Tue, 06 Oct 2009 20:05:39 -0000 |
From: Mark McLoughlin <address@hidden>
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: Mark McLoughlin <address@hidden>
Signed-off-by: Anthony Liguori <address@hidden>
diff --git a/net.c b/net.c
index 76e44c9..f2b472d 100644
--- a/net.c
+++ b/net.c
@@ -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)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Qemu-commits] [COMMIT d2cffe3] Move memset() from net_client_uninit() tonet_client_init(),
Anthony Liguori <=