Re: [PATCH v3 03/27] util/hexdump: Use a GString for qemu_hexdump_line

2024-04-13 Thread Stefan Hajnoczi
On Sat, 13 Apr 2024 at 05:46, Philippe Mathieu-Daudé wrote: > > On 12/4/24 20:59, Richard Henderson wrote: > > On 4/12/24 10:41, Philippe Mathieu-Daudé wrote: > >>> -void qemu_hexdump_line(char *line, const void *bufptr, size_t len) > >>> +GString *qemu_hexdump_line(GString *str, const void *vbuf,

Re: [PATCH v3 03/27] util/hexdump: Use a GString for qemu_hexdump_line

2024-04-13 Thread Philippe Mathieu-Daudé
On 12/4/24 20:59, Richard Henderson wrote: On 4/12/24 10:41, Philippe Mathieu-Daudé wrote: -void qemu_hexdump_line(char *line, const void *bufptr, size_t len) +GString *qemu_hexdump_line(GString *str, const void *vbuf, size_t len)   { -    const char *buf = bufptr; -    int i, c; +    const uint

Re: [PATCH v3 03/27] util/hexdump: Use a GString for qemu_hexdump_line

2024-04-12 Thread Richard Henderson
On 4/12/24 10:41, Philippe Mathieu-Daudé wrote: -void qemu_hexdump_line(char *line, const void *bufptr, size_t len) +GString *qemu_hexdump_line(GString *str, const void *vbuf, size_t len)   { -    const char *buf = bufptr; -    int i, c; +    const uint8_t *buf = vbuf; +    size_t i; -    if (len

Re: [PATCH v3 03/27] util/hexdump: Use a GString for qemu_hexdump_line

2024-04-12 Thread Philippe Mathieu-Daudé
On 12/4/24 09:33, Richard Henderson wrote: Allocate a new, or append to an existing GString instead of using a fixed sized buffer. Require the caller to determine the length of the line -- do not bound len here. Signed-off-by: Richard Henderson --- include/qemu/cutils.h | 15 ++-

[PATCH v3 03/27] util/hexdump: Use a GString for qemu_hexdump_line

2024-04-12 Thread Richard Henderson
Allocate a new, or append to an existing GString instead of using a fixed sized buffer. Require the caller to determine the length of the line -- do not bound len here. Signed-off-by: Richard Henderson --- include/qemu/cutils.h | 15 ++- hw/virtio/vhost-vdpa.c | 14 --