[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v6 12/15] qapi: Support pretty printing in JSON
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH v6 12/15] qapi: Support pretty printing in JSON output visitor |
Date: |
Tue, 11 Oct 2016 10:09:11 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 |
On 10/11/2016 06:20 AM, Marc-André Lureau wrote:
> On Mon, Oct 10, 2016 at 5:44 PM Eric Blake <address@hidden> wrote:
>
>> Add pretty printing, where the format intentionally matches that of
>> qobject_to_json() (a later patch will then rework qobject-json.c to
>> work on top of the JSON visitor). The trickiest part is probably
>> that the testsuite now has to honor parameterization on whether
>> pretty printing is enabled.
>>
>>
>> static void visitor_output_setup(TestOutputVisitorData *data,
>> - const void *unused)
>> + const void *arg)
>> {
>> - data->ov = json_output_visitor_new(&data->str);
>> + bool pretty = *(bool *)arg;
>> +
>>
>
> Have you considered GPOINTER_TO_INT/GINT_TO_POINTER instead of pointers to
> the stack frame?
Casting integer values to void* and back requires a lot of typing to
pacify all compilers (either explicit casts, or casts hidden inside the
lengthy macro names from glib); and fails to work for 64-bit values when
void* is only 32 bits. Dereferencing a stack pointer is a lot less
thought and less typing, and works regardless of the integer size.
>
> either way, it's fine.
>
Good, I won't bother changing it.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- [Qemu-devel] [PATCH v6 00/15] Add qapi-to-JSON visitor, Eric Blake, 2016/10/10
- [Qemu-devel] [PATCH v6 01/15] qapi: Visitor documentation tweak, Eric Blake, 2016/10/10
- [Qemu-devel] [PATCH v6 03/15] qapi: Factor out JSON string escaping, Eric Blake, 2016/10/10
- [Qemu-devel] [PATCH v6 04/15] qapi: Factor out JSON number formatting, Eric Blake, 2016/10/10
- [Qemu-devel] [PATCH v6 05/15] qapi: Add qstring_append_printf(), Eric Blake, 2016/10/10
- [Qemu-devel] [PATCH v6 06/15] qapi: Use qstring_append_chr() where appropriate, Eric Blake, 2016/10/10
- [Qemu-devel] [PATCH v6 07/15] qstring: Add qstring_consume_str(), Eric Blake, 2016/10/10
- [Qemu-devel] [PATCH v6 02/15] qapi: Assert finite use of 'number', Eric Blake, 2016/10/10
- [Qemu-devel] [PATCH v6 12/15] qapi: Support pretty printing in JSON output visitor, Eric Blake, 2016/10/10
- [Qemu-devel] [PATCH v6 11/15] qapi: Add JSON output visitor, Eric Blake, 2016/10/10
- [Qemu-devel] [PATCH v6 10/15] tests: Test qobject_to_json() pretty formatting, Eric Blake, 2016/10/10
- [Qemu-devel] [PATCH v6 14/15] qapi: Add 'any' support to JSON output, Eric Blake, 2016/10/10
- [Qemu-devel] [PATCH v6 13/15] qobject: Implement qobject_to_json() atop JSON visitor, Eric Blake, 2016/10/10
- [Qemu-devel] [PATCH v6 09/15] qobject: Consolidate qobject_to_json() calls, Eric Blake, 2016/10/10
- [Qemu-devel] [PATCH v6 08/15] qstring: Add qstring_wrap_str(), Eric Blake, 2016/10/10