Hi On Mon, Dec 21, 2015 at 6:08 PM, Eric Blake <ebl...@redhat.com> wrote: > As mentioned in previous patches, we want to call visit_end_struct() > functions unconditionally, so that visitors can release resources > tied up since the matching visit_start_struct() without also having > to worry about error priority if more than one error occurs. > > Even though error_propagate() can be safely used to ignore a second > error during cleanup caused by a first error, it is simpler if the > cleanup cannot set an error, and we instead split the task of > checking that an input visitor has no unvisited input as a new > function visit_check_struct(), called only if all prior steps are > successful. > > Generated code has diffs resembling: > > |@@ -59,10 +59,12 @@ void visit_type_ACPIOSTInfo(Visitor *v, > | goto out_obj; > | } > | visit_type_ACPIOSTInfo_fields(v, obj, &err); > |+ if (err) { > |+ goto out_obj; > |+ } > |+ visit_check_struct(v, &err); > | out_obj: > |- error_propagate(errp, err); > |- err = NULL; > |- visit_end_struct(v, &err); > |+ visit_end_struct(v); > | out: > > Signed-off-by: Eric Blake <ebl...@redhat.com> >
Reviewed-by: Marc-André Lureau <marcandre.lur...@redhat.com> -- Marc-André Lureau