qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v4 25/28] qapi: Support pretty printing in JSON


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH v4 25/28] qapi: Support pretty printing in JSON output visitor
Date: Fri, 3 Jun 2016 06:55:34 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

On 06/03/2016 01:56 AM, Markus Armbruster wrote:
> Eric Blake <address@hidden> writes:
> 
>> Similar to pretty printing in the QObject visitor.  The trickiest
>> part is probably that the testsuite now has to honor parameterization
>> on whether pretty printing is enabled.
> 
> Worth mentioning that the pretty-printing matches the one in
> qobject-json.c?

Yes, particularly since we later rely on that fact to rewrite
qobject-json.c on top of the JSON visitor :)


>>  static void visitor_output_setup(TestOutputVisitorData *data,
>> -                                 const void *unused)
>> +                                 const void *arg)
>>  {
>> -    data->ov = json_output_visitor_new(&data->str);
>> +    const bool *pretty = arg;
> 
> Could do bool pretty = *(bool *)arg.  Matter of taste.  Same elsewhere.

Requires a cast.  I like avoiding casts where C lets us do so. But I
also agree that *pretty looks ugly, so maybe:

...(const void *arg)
{
    const bool *data;
    bool pretty = *data;


-- 
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]