On 04/29/2016 02:28 AM, Markus Armbruster wrote: > Eric Blake <ebl...@redhat.com> writes: > >> Our existing input visitors were not very consistent on errors >> in a function taking 'TYPE **obj' (that is, start_struct(), >> start_alternate(), type_str(), and type_any(). next_list() is >> similar, except that since commit 08f9541, it can't fail). > > Multiple sentences in a parenthesis, ugh :) > > Our existing input visitors were not very consistent on errors in a > function taking 'TYPE **obj'. These are start_struct(), > start_alternate(), type_str(), and type_any(). next_list() is > similar, but can't fail (see commit since 08f9541). > > Can touch up on commit. >
Yes, sounds better. >> @@ -51,10 +57,16 @@ void visit_start_alternate(Visitor *v, const char *name, >> GenericAlternate **obj, size_t size, >> bool promote_int, Error **errp) >> { >> + Error *err = NULL; >> + >> assert(obj && size >= sizeof(GenericAlternate)); >> if (v->start_alternate) { >> - v->start_alternate(v, name, obj, size, promote_int, errp); >> + v->start_alternate(v, name, obj, size, promote_int, &err); >> } >> + if (v->type == VISITOR_INPUT) { >> + assert(!err != !*obj); > > Could assert(v->start_alternate && !err != !*obj), to preempt "what if > !v->start_alternate" worries. If you like that, I can do it on commit. Can't hurt :) -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature