From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mv84M-0006uo-S8 for qemu-devel@nongnu.org; Tue, 06 Oct 2009 07:19:03 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mv84E-0006qG-Vb for qemu-devel@nongnu.org; Tue, 06 Oct 2009 07:18:59 -0400 Received: from [199.232.76.173] (port=40400 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mv84D-0006pq-RE for qemu-devel@nongnu.org; Tue, 06 Oct 2009 07:18:53 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46019) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Mv84D-0007s9-AX for qemu-devel@nongnu.org; Tue, 06 Oct 2009 07:18:53 -0400 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n96BIqPM015871 for ; Tue, 6 Oct 2009 07:18:52 -0400 From: Mark McLoughlin Date: Tue, 6 Oct 2009 12:16:54 +0100 Message-Id: <1254827836-11021-5-git-send-email-markmc@redhat.com> In-Reply-To: <1254827783.2720.42.camel@blaa> References: <1254827783.2720.42.camel@blaa> Subject: [Qemu-devel] [PATCH] Move memset() from net_client_uninit() to net_client_init() List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Mark McLoughlin 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 --- 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