[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 06/14] qapi: Add qstring_append_format()
From: |
Fam Zheng |
Subject: |
Re: [Qemu-devel] [PATCH v2 06/14] qapi: Add qstring_append_format() |
Date: |
Wed, 23 Dec 2015 16:31:29 +0800 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Mon, 12/21 17:31, Eric Blake wrote:
> Back in commit 764c1ca (Nov 2009), we added qstring_append_int().
> However, it did not see any use until commit 190c882 (Jan 2015).
> Furthermore, it has a rather limited use case - to print anything
> else, callers still have to format into a temporary buffer, unless
> we want to introduce an explosion of new qstring_append_* methods
> for each useful type to print.
>
> A much better approach is to add a wrapper that merges printf
> behavior onto qstring_append, via the new qstring_append_format()
> (and its vararg counterpart). In fact, with that in place, we
> no longer need qstring_append_int().
>
> Other immediate uses for the new function include simplifying
> two existing clients of qstring_append() on a just-formatted
> buffer, and the fact that we can take advantage of printf width
> manipulations for more efficient indentation.
>
> Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: Fam Zheng <address@hidden>
- [Qemu-devel] [PATCH v2 00/14] Add qapi-to-JSON output visitor, Eric Blake, 2015/12/21
- [Qemu-devel] [PATCH v2 02/14] qapi: Improve use of qmp/types.h, Eric Blake, 2015/12/21
- [Qemu-devel] [PATCH v2 05/14] qapi: Use qstring_append_chr() where appropriate, Eric Blake, 2015/12/21
- [Qemu-devel] [PATCH v2 04/14] qapi: Factor out JSON number formatting, Eric Blake, 2015/12/21
- [Qemu-devel] [PATCH v2 06/14] qapi: Add qstring_append_format(), Eric Blake, 2015/12/21
- Re: [Qemu-devel] [PATCH v2 06/14] qapi: Add qstring_append_format(),
Fam Zheng <=
- [Qemu-devel] [PATCH v2 03/14] qapi: Factor out JSON string escaping, Eric Blake, 2015/12/21
- [Qemu-devel] [PATCH v2 08/14] qjson: Simplify by using json-output-visitor, Eric Blake, 2015/12/21
- [Qemu-devel] [PATCH v2 10/14] vmstate: use new JSON output visitor, Eric Blake, 2015/12/21
- [Qemu-devel] [PATCH v2 07/14] qapi: add json output visitor, Eric Blake, 2015/12/21
- [Qemu-devel] [PATCH v2 11/14] qjson: Remove unused file, Eric Blake, 2015/12/21
- [Qemu-devel] [PATCH v2 12/14] qapi: Add qobject_to_json_pretty_prefix(), Eric Blake, 2015/12/21
- [Qemu-devel] [PATCH v2 01/14] qapi: Rename (one) qjson.h to qobject-json.h, Eric Blake, 2015/12/21
- [Qemu-devel] [PATCH v2 14/14] qemu-img: Use new JSON output formatter, Eric Blake, 2015/12/21
- [Qemu-devel] [PATCH v2 09/14] Revert "qjson: Simplify by using json-output-visitor", Eric Blake, 2015/12/21