[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 1/2] qemu_hexstr(): hexdump a small buffer to a
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-devel] [PATCH 1/2] qemu_hexstr(): hexdump a small buffer to a string, for in-line printing |
Date: |
Thu, 29 Aug 2013 18:32:12 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) |
Laszlo Ersek <address@hidden> writes:
> This function should primarily serve tracing needs.
>
> Signed-off-by: Laszlo Ersek <address@hidden>
> ---
> include/qemu-common.h | 11 +++++++++++
> util/hexdump.c | 20 ++++++++++++++++++++
> 2 files changed, 31 insertions(+), 0 deletions(-)
>
> diff --git a/include/qemu-common.h b/include/qemu-common.h
> index 6948bb9..18a373f 100644
> --- a/include/qemu-common.h
> +++ b/include/qemu-common.h
> @@ -433,6 +433,17 @@ int mod_utf8_codepoint(const char *s, size_t n, char
> **end);
>
> void qemu_hexdump(const char *buf, FILE *fp, const char *prefix, size_t
> size);
>
> +/*
> + * Hexdump @size bytes from @buf to a dynamically allocated string.
> + * If @size is NULL, then @buf can be a NULL pointer, and an empty string
> will
If @size is zero
> + * be formatted.
> + * If @str_len is non-NULL, then the length of the output string (excluding
> the
> + * terminating NUL) will be stored in address@hidden
> + * The output is meant to be printed on a single line, hence it contains no
> + * newlines, and @size should be reasonable.
> + */
> +char *qemu_hexstr(const void *buf, size_t size, size_t *str_len);
> +
> /* vector definitions */
> #ifdef __ALTIVEC__
> #include <altivec.h>
[...]