From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44876) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZkGyJ-0004ad-I6 for qemu-devel@nongnu.org; Thu, 08 Oct 2015 15:35:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZkGyG-0006Ch-Tr for qemu-devel@nongnu.org; Thu, 08 Oct 2015 15:35:23 -0400 From: Thomas Huth Date: Thu, 8 Oct 2015 21:35:11 +0200 Message-Id: <1444332916-16476-1-git-send-email-thuth@redhat.com> Subject: [Qemu-devel] [PATCH 0/5] Small optimizations for code using g_malloc0 + memset/memcpy List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: qemu-trivial@nongnu.org There are a couple of spots in the QEMU code which use g_malloc0, directly followed by a memset or memcpy which fill the whole allocated buffer. In this case it either does not make sense to zero the buffer via g_malloc0 first (so g_malloc should be used instead), or if the second command is a memset(..., 0, ...), then the memset does not make much sense, of course, since the buffer has already been zeroed by the g_malloc0. Thomas Huth (5): hw/dma/pxa2xx: Remove superfluous memset hw/scsi/spapr_vscsi: Remove superfluous memset hw/input/tsc210x: Remove superfluous memset tests/i44fx-test: No need for zeroing memory before memset linux-user/syscall: Replace g_malloc0 + memcpy with g_memdup hw/dma/pxa2xx_dma.c | 1 - hw/input/tsc210x.c | 8 ++------ hw/scsi/spapr_vscsi.c | 1 - linux-user/syscall.c | 3 +-- tests/i440fx-test.c | 2 +- 5 files changed, 4 insertions(+), 11 deletions(-) -- 1.8.3.1