Received: from eggs.gnu.org ([2001:4830:134:3::10]:40545) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VF58w-0008UB-TI for qemu-devel@nongnu.org; Thu, 29 Aug 2013 12:32:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VF58q-0000vU-Su for qemu-devel@nongnu.org; Thu, 29 Aug 2013 12:32:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:4094) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VF58q-0000vN-L3 for qemu-devel@nongnu.org; Thu, 29 Aug 2013 12:32:16 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r7TGWFOU010746 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 29 Aug 2013 12:32:15 -0400 From: Markus Armbruster References: <521F4E76.2090507@redhat.com> <1377783470-8981-1-git-send-email-lersek@redhat.com> Date: Thu, 29 Aug 2013 18:32:12 +0200 In-Reply-To: <1377783470-8981-1-git-send-email-lersek@redhat.com> (Laszlo Ersek's message of "Thu, 29 Aug 2013 15:37:49 +0200") Message-ID: <87ob8gihkj.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH 1/2] qemu_hexstr(): hexdump a small buffer to a string, for in-line printing List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Laszlo Ersek Cc: pbonzini@redhat.com, qemu-devel@nongnu.org Laszlo Ersek writes: > This function should primarily serve tracing needs. > > Signed-off-by: Laszlo Ersek > --- > 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 *@str_len. > + * 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 [...]