Skip to content

Replacing malloc and the like with GLib's variants

Mahmoud Mandour qemu-devel 1 version NAK

Status from this message: Nack.

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest9 patches 2 repliesNAK

Patches in v1

#Subject and filesSizeRepliesApplied
1/9bsd-user/elfload.c: Replaced calls to malloc/free with GLib variantsbsd-user/elfload.c+37 -370 replies
2/9hw/audio/fmopl.c: Fixing some style errors.hw/audio/fmopl.c+26 -260 replies
3/9hw/audio/fmopl.c: Replaced calls to malloc with GLib's variantshw/audio/fmopl.c+24 -170 replies
4/9pc-bios/s390-ccw/netmain.c: Changed a malloc/free to GLib's variantspc-bios/s390-ccw/netmain.c+3 -32 replies
5/9target/xtensa: Replaced malloc/free with GLib's variants.target/xtensa/xtensa-isa.c+14 -140 replies
6/9util/compatfd.c: Replaced a malloc with GLib's g_try_mallocutil/compatfd.c+5 -50 replies
7/9tools/virtiofsd/buffer.c: replaced a calloc call with GLib's g_try_new0tools/virtiofsd/buffer.c+2 -20 replies
8/9tools/virtiofsd/fuse_opt.c: Replaced a malloc with GLib's g_try_malloctools/virtiofsd/fuse_opt.c+2 -20 replies
9/9tools/virtiofsd: Replacing malloc-like calls with GLib's variantstools/virtiofsd/fuse_lowlevel.c tools/virtiofsd/fuse_virtio.c tools/virtiofsd/passthrough_ll.c+48 -480 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/9] Replacing malloc and the like with GLib's variants

Inspired by the task in the Bite-sized tasks page, I've tried to change some of the occurrences of malloc(), calloc(), and realloc() calls and their respective free() calls. I also included some minor style improvements that caused errors and warnings when supplied to the checkpatch.pl script.

At numerous places, the change is quite obvious. However, some other malloc() and the like have no immediately visible free() calls. Analysis was done to trace the roots of each free() call to match each GLib function with a g_free(), and every malloc(), realloc(), or calloc() call with a call to free().

Mahmoud Mandour (9):
bsd-user/elfload.c: Replaced calls to malloc/free with GLib variants hw/audio/fmopl.c: Fixing some style errors. hw/audio/fmopl.c: Replaced calls to malloc with GLib's variants pc-bios/s390-ccw/netmain.c: Changed a malloc/free to GLib's variants target/xtensa: Replaced malloc/free with GLib's variants. util/compatfd.c: Replaced a malloc with GLib's g_try_malloc tools/virtiofsd/buffer.c: replaced a calloc call with GLib's

    g_try_new0

tools/virtiofsd/fuse_opt.c: Replaced a malloc with GLib's g_try_malloc tools/virtiofsd: Replacing malloc-like calls with GLib's variants

 bsd-user/elfload.c               | 74 ++++++++++++++++----------------
 hw/audio/fmopl.c                 | 61 ++++++++++++++------------
 pc-bios/s390-ccw/netmain.c       |  6 +--
 target/xtensa/xtensa-isa.c       | 28 ++++++------
 tools/virtiofsd/buffer.c         |  4 +-
 tools/virtiofsd/fuse_lowlevel.c  | 30 ++++++-------
 tools/virtiofsd/fuse_opt.c       |  4 +-
 tools/virtiofsd/fuse_virtio.c    | 34 +++++++--------
 tools/virtiofsd/passthrough_ll.c | 32 +++++++-------
 util/compatfd.c                  | 10 ++---
 10 files changed, 145 insertions(+), 138 deletions(-)
Signature · 1 line
2.25.1