[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH] Move memset() from net_client_uninit() to net_clien
From: |
Mark McLoughlin |
Subject: |
[Qemu-devel] [PATCH] Move memset() from net_client_uninit() to net_client_init() |
Date: |
Tue, 6 Oct 2009 12:16:54 +0100 |
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>
---
net.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
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)
--
1.6.2.5
- [Qemu-devel] [PATCH 00/19 v3] Port -net to QemuOpts, Mark McLoughlin, 2009/10/06
- [Qemu-devel] [PATCH] Don't assign a static string to NICInfo::model, Mark McLoughlin, 2009/10/06
- [Qemu-devel] [PATCH] Make NICInfo string fields non-const, Mark McLoughlin, 2009/10/06
- [Qemu-devel] [PATCH] Register rtc options for -set, Mark McLoughlin, 2009/10/06
- [Qemu-devel] [PATCH] Use qemu_strdup() for NICInfo string fields, Mark McLoughlin, 2009/10/06
- [Qemu-devel] [PATCH] Use qemu_strdup() for VLANClientState string fields, Mark McLoughlin, 2009/10/06
- [Qemu-devel] [PATCH] Make qemu_opts_parse() handle empty strings, Mark McLoughlin, 2009/10/06
- [Qemu-devel] [PATCH] Move memset() from net_client_uninit() to net_client_init(),
Mark McLoughlin <=
- [Qemu-devel] [PATCH] Don't exit() in config_error(), Mark McLoughlin, 2009/10/06
- [Qemu-devel] [PATCH] Add qemu_opts_validate() for post parsing validation, Mark McLoughlin, 2009/10/06
- [Qemu-devel] [PATCH] Make net_client_init() consume slirp_configs even on error, Mark McLoughlin, 2009/10/06
- [Qemu-devel] [PATCH] Remove bogus error message from qemu_opts_set(), Mark McLoughlin, 2009/10/06
- [Qemu-devel] [PATCH] Remove double error message in qemu_option_set(), Mark McLoughlin, 2009/10/06
- [Qemu-devel] [PATCH] Drop config_error(), use qemu_error() instead, Mark McLoughlin, 2009/10/06
- [Qemu-devel] [PATCH] Final net cleanup after conversion to QemuOpts, Mark McLoughlin, 2009/10/06
- [Qemu-devel] [PATCH] Remove double error message for -device option parsing, Mark McLoughlin, 2009/10/06
- [Qemu-devel] [PATCH] Never overwrite a QemuOpt, Mark McLoughlin, 2009/10/06
- [Qemu-devel] [PATCH] Port -net vde to QemuOpts, Mark McLoughlin, 2009/10/06