On 09/17/2015 02:30 PM, Eric Blake wrote:
> On 09/07/2015 06:08 AM, Kővágó, Zoltán wrote:
>> They are required for flat unions (you still have to allocate the
>> structs).
>>
>> Signed-off-by: Kővágó, Zoltán <dirty.ice...@gmail.com>
>> ---
>>  qapi/opts-visitor.c | 15 +++++++++++++++
>>  1 file changed, 15 insertions(+)
> 
> Reviewed-by: Eric Blake <ebl...@redhat.com>
> 
> and required for 'make check' to pass when 4/7 is applied, so:
> 
> Tested-by: Eric Blake <ebl...@redhat.com>
> 
>>
>> diff --git a/qapi/opts-visitor.c b/qapi/opts-visitor.c
>> index 7ae33b3..aa68814 100644
>> --- a/qapi/opts-visitor.c
>> +++ b/qapi/opts-visitor.c
>> @@ -149,6 +149,12 @@ opts_start_struct(Visitor *v, void **obj, const char 
>> *kind,
>>      }
>>  }
>>  
>> +static void
>> +opts_start_implicit_struct(Visitor *v, void **obj, size_t size, Error 
>> **errp)
>> +{
>> +    opts_start_struct(v, obj, NULL, NULL, size, errp);
> 
> Works because ov->depth is always non-zero by the time any visitor
> reaches this callback, triggering the early return in
> opts_start_struct().  Might be slightly safer if you just did the
> g_malloc0() here, to make sure no caller ever ends up re-initializing
> ov->unprocessed_opts, but what you have works.
> 

In fact, the alternative that just does a local malloc was proposed here:
https://lists.gnu.org/archive/html/qemu-devel/2015-09/msg04746.html

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