qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v11 12/15] qapi: Don't box struct branch of alte


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH v11 12/15] qapi: Don't box struct branch of alternate
Date: Thu, 18 Feb 2016 09:56:54 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0

On 02/18/2016 09:43 AM, Markus Armbruster wrote:
> Eric Blake <address@hidden> writes:
> 
>> There's no reason to do two malloc's for an alternate type visiting
>> a QAPI struct; let's just inline the struct directly as the C union
>> branch of the struct.
>>
>>
>> meanwhile, in qapi-visit.h, we trade the previous visit_type_FOO(obj)
> 
> Meanwhile
> 
>> (which allocates a pointer, handles a layer of {} from the JSON stream,
>> and visits the fields)

Maybe:

(which first calls visit_start_struct(v, name, obj, size, &err) to
allocate a pointer and handle a layer of {} from the JSON stream, then
visits the fields)

>>                         with an inline call to visit_type_FOO(NULL) (to
>> consume the {} without allocation) and a direct visit of the fields:
> 
> I don't see a call to visit_type_FOO(NULL).

Whoops, wrong function name.  I meant:

visit_start_struct(v, name, NULL, 0, &err).
                            ^^^^
Especially useful if you take my earlier text suggestion to point out
the difference in the visit_start_struct() calls as being the
intentional so that we continue to consume {} but now opt out of a
second allocation.

> 
> Suggest not to abbreviate argument lists, it's mildly confusing.

Sure. Are we still at a point that you could touch up the commit message
without a patch respin?

> 
> Patch looks good.
> 

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