[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-ppc] [Qemu-devel] [PATCH v8 14/35] qapi: Swap visit_* argument
From: |
Eric Blake |
Subject: |
Re: [Qemu-ppc] [Qemu-devel] [PATCH v8 14/35] qapi: Swap visit_* arguments for consistent 'name' placement |
Date: |
Tue, 5 Jan 2016 08:32:47 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 |
On 01/05/2016 07:06 AM, Marc-André Lureau wrote:
> Reviewed-by: Marc-André Lureau <address@hidden>Hi
>
> On Mon, Dec 21, 2015 at 6:08 PM, Eric Blake <address@hidden> wrote:
>> JSON uses "name":value, but many of our visitor interfaces were
>> called with visit_type_FOO(v, &value, name, errp). This can be
>> a bit confusing to have to mentally swap the parameter order to
>> match JSON order. It's particularly bad for visit_start_struct(),
>> where the 'name' parameter is smack in the middle of the
>> otherwise-related group of 'obj, kind, size' parameters! It's
>> time to do a global swap of the parameter ordering, so that the
>> 'name' parameter is always immediately after the Visitor argument.
>>
>
> fwiw, I do agree.
>
>> Additional reasons in favor of the swap: name is always an input
>> parameter, while &value is sometimes an output parameter (depending
>> on whether the caller is using an input visitor); and it is nicer
>> to list input parameters first. Also, the existing include/qjson.h
>> prefers listing 'name' first in json_prop_*(), and I have plans to
>> unify that file with the qapi visitors; listing 'name' first in
>> qapi will minimize churn to the (admittedly few) qjson.h clients.
>>
>> The next patches will then fix object.h, visitor-impl.h, and those
>> clients to match.
>>
>
> The result looks good and passes the tests
> Reviewed-by: Marc-André Lureau <address@hidden>
>
> However, docs/qapi-code-gen.txt should be updated in a follow-up patch.
D'oh - I knew I'd forget something :) You're right, of course.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature