qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v9 08/37] qapi: Track all failures between visit


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH v9 08/37] qapi: Track all failures between visit_start/stop
Date: Wed, 20 Jan 2016 10:15:59 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0

On 01/20/2016 09:03 AM, Markus Armbruster wrote:
> Eric Blake <address@hidden> writes:
> 
>> Inside the generated code between visit_start_struct() and
>> visit_end_struct(), we were blindly setting the error into
>> the caller's errp parameter.  But a future patch to split
>> visit_end_struct() will require that we take action based
>> on whether an error has occurred, which requires us to track
>> all actions through a local err.  Rewrite the visits to be
>> more in line with the other generated calls.
>>

>> |+    if (!*obj) {
> 
> err is clear here.
> 
>> |+        goto out_obj;
>> |+    }
>> |+    visit_type_GuestAgentCommandInfo_fields(v, obj, &err);
>> |+out_obj:
>> |+    error_propagate(errp, err);
>> |+    err = NULL;
> 
> If we come from goto out_obj, these two lines are no-ops.

I could move the label, if desired...

> 
>> |+    visit_end_struct(v, &err);
>> |+out:
>> |     error_propagate(errp, err);
>> | }

> 
> gen_visit_union(), the other generator of visit_start_struct(), already
> does it this way.  It generates additional goto out_obj, so the
> placement of out_obj makes more sense there.  I guess we want to place
> it in the same spot here to facilitate unifying the two.

...but as you observed, the unification in 31 is a bit easier with it
placed identically.  Maybe a commit message comment is in order.

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