Skip to content

Small optimizations for code using g_malloc0 + memset/memcpy

Thomas Huth qemu-devel qemu-trivial 2 versions – Applied

Status from this message: Applied to linux-user, thanks

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest4 patches 4 repliesApplied
  2. v15 patches 11 repliesApplied

Changes in v2 from the cover letter

- Switched some of the g_malloc0()s to g_new0()s where appropriate
- Added Reviewed-by-s
- The spapr_vscsi patch has been picked up by David already, so not sending it again

Patches in v2 Applied

#Subject and filesSizeRepliesApplied
1/4hw/dma/pxa2xx: Remove superfluous memsethw/dma/pxa2xx_dma.c+1 -21 reply
2/4hw/input/tsc210x: Remove superfluous memsethw/input/tsc210x.c+2 -61 reply
3/4tests/i44fx-test: No need for zeroing memory before memsettests/i440fx-test.c+1 -10 replies
4/4linux-user/syscall: Replace g_malloc0 + memcpy with g_memduplinux-user/syscall.c+1 -21 reply

Reviews trailers per patch

All 4 patches have a Reviewed-by or Acked-by.

PatchLaszlo ErsekEric Blake
1/4R-b
2/4R-b
3/4R-b
4/4R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [Qemu-devel] [PATCH v2 0/4] Small optimizations for code using g_malloc0 + memset/memcpy

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.

v2:
- Switched some of the g_malloc0()s to g_new0()s where appropriate
- Added Reviewed-by-s
- The spapr_vscsi patch has been picked up by David already, so not sending it again

Thomas Huth (4):
hw/dma/pxa2xx: 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  | 3 +--
 hw/input/tsc210x.c   | 8 ++------
 linux-user/syscall.c | 3 +--
 tests/i440fx-test.c  | 2 +-
 4 files changed, 5 insertions(+), 11 deletions(-)
Signature · 1 line
1.8.3.1