qemu-devel
[Top][All Lists]
Advanced

[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

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]