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: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH v4 25/28] qapi: Support pretty printing in JSON output visitor
Date: Fri, 03 Jun 2016 16:08:41 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Eric Blake <address@hidden> writes:

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

Fewer casts are generally better, but so are fewer variables.  Pick a
solution you like.  The one you chose for this patch is acceptable.



reply via email to

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