[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PULL 14/15] qapi: Don't box branches of flat unions
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PULL 14/15] qapi: Don't box branches of flat unions |
Date: |
Tue, 23 Feb 2016 08:30:28 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 |
On 02/23/2016 08:18 AM, Eric Blake wrote:
>>
>> I could visit_type_QCryptoBlockOptionsLUKS_fields(v, opts.u.luks, errp)
>> but the '_fields' methods are all declared static in qapi-visit.c
>> preventing their use.
>>
>> IMHO, now that QAPI inlines the flat unions, we should be making
>> the _fields() methods public.
>
> But my suggestion would just be a hack. Yours makes more sense in the
> long run, so I'll go ahead and propose that patch.
Another alternative, but not my preference (mentioning only for
completeness):
We could change the contract of visit_type_FOO(&obj) to say that if it
points to non-NULL, we just visit the fields in place. All callers
would then be required to set *obj = NULL prior to visit_type_FOO(&obj)
for existing semantics, and you would set *obj = &parent.u.luks for new
semantics.
But this would entail an audit of existing callers (too many are passing
uninitialized pointers, which must now be initialized), and feels a bit
too complex.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- [Qemu-devel] [PULL 10/15] qapi: Adjust layout of FooList types, (continued)
- [Qemu-devel] [PULL 10/15] qapi: Adjust layout of FooList types, Markus Armbruster, 2016/02/19
- [Qemu-devel] [PULL 13/15] qapi: Don't box struct branch of alternate, Markus Armbruster, 2016/02/19
- [Qemu-devel] [PULL 03/15] qapi: Forbid empty unions and useless alternates, Markus Armbruster, 2016/02/19
- [Qemu-devel] [PULL 11/15] qapi: Emit structs used as variants in topological order, Markus Armbruster, 2016/02/19
- [Qemu-devel] [PULL 07/15] qapi: Visit variants in visit_type_FOO_fields(), Markus Armbruster, 2016/02/19
- [Qemu-devel] [PULL 05/15] qapi: Add tests of complex objects within alternate, Markus Armbruster, 2016/02/19
- [Qemu-devel] [PULL 15/15] qapi: Change visit_start_implicit_struct to visit_start_alternate, Markus Armbruster, 2016/02/19
- [Qemu-devel] [PULL 14/15] qapi: Don't box branches of flat unions, Markus Armbruster, 2016/02/19
- Re: [Qemu-devel] [PULL 00/15] QAPI patches for 2016-02-19, Peter Maydell, 2016/02/19