From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:56650) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QGGy0-0006Ry-MG for qemu-devel@nongnu.org; Sat, 30 Apr 2011 16:40:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QGGxz-0000WW-NU for qemu-devel@nongnu.org; Sat, 30 Apr 2011 16:40:40 -0400 Received: from moutng.kundenserver.de ([212.227.126.186]:64235) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QGGxz-0000WD-Bb for qemu-devel@nongnu.org; Sat, 30 Apr 2011 16:40:39 -0400 From: Stefan Weil Date: Sat, 30 Apr 2011 22:40:06 +0200 Message-Id: <1304196013-14432-4-git-send-email-weil@mail.berlios.de> In-Reply-To: <1304196013-14432-1-git-send-email-weil@mail.berlios.de> References: <1304196013-14432-1-git-send-email-weil@mail.berlios.de> Subject: [Qemu-devel] [PATCH v2 03/10] eepro100: Remove unused structure element List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: QEMU Developers cppcheck reports that 'packet' is unused. It was only used to calculate the size of the preceding data. Removing it saves a lot of stack space (local variable rx). Signed-off-by: Stefan Weil --- hw/eepro100.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/eepro100.c b/hw/eepro100.c index 0e22d91..82c6369 100644 --- a/hw/eepro100.c +++ b/hw/eepro100.c @@ -173,7 +173,7 @@ typedef struct { uint32_t rx_buf_addr; /* void * */ uint16_t count; uint16_t size; - char packet[MAX_ETH_FRAME_SIZE + 4]; + /* Ethernet frame data follows. */ } eepro100_rx_t; typedef enum { @@ -1738,7 +1738,7 @@ static ssize_t nic_receive(VLANClientState *nc, const uint8_t * buf, size_t size /* !!! */ eepro100_rx_t rx; cpu_physical_memory_read(s->ru_base + s->ru_offset, &rx, - offsetof(eepro100_rx_t, packet)); + sizeof(eepro100_rx_t)); uint16_t rfd_command = le16_to_cpu(rx.command); uint16_t rfd_size = le16_to_cpu(rx.size); @@ -1769,7 +1769,7 @@ static ssize_t nic_receive(VLANClientState *nc, const uint8_t * buf, size_t size assert(!(s->configuration[17] & BIT(0))); #endif cpu_physical_memory_write(s->ru_base + s->ru_offset + - offsetof(eepro100_rx_t, packet), buf, size); + sizeof(eepro100_rx_t), buf, size); s->statistics.rx_good_frames++; eepro100_fr_interrupt(s); s->ru_offset = le32_to_cpu(rx.link); -- 1.7.2.5