From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56400) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aw819-0004Yo-Fu for qemu-devel@nongnu.org; Fri, 29 Apr 2016 08:59:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aw80x-0000P7-Rp for qemu-devel@nongnu.org; Fri, 29 Apr 2016 08:59:30 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38160) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aw80x-0000NE-NS for qemu-devel@nongnu.org; Fri, 29 Apr 2016 08:59:23 -0400 From: Markus Armbruster References: <1461879932-9020-1-git-send-email-eblake@redhat.com> <1461879932-9020-3-git-send-email-eblake@redhat.com> <87eg9o7r95.fsf@dusky.pond.sub.org> <57234F4B.1010701@redhat.com> <572350F4.7090700@redhat.com> Date: Fri, 29 Apr 2016 14:59:10 +0200 In-Reply-To: <572350F4.7090700@redhat.com> (Eric Blake's message of "Fri, 29 Apr 2016 06:17:56 -0600") Message-ID: <87vb30y3j5.fsf@dusky.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH v16 02/24] qapi: Guarantee NULL obj on input visitor callback error List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: qemu-devel@nongnu.org, Michael Roth Eric Blake writes: > On 04/29/2016 06:10 AM, Eric Blake wrote: >> On 04/29/2016 02:28 AM, Markus Armbruster wrote: >>> Eric Blake 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. > > Spoke too soon: "see commit since 08f9541" is too wordy, should be > either "see commit 08f9541" or "since commit 08f9541" I'm terribly prone to leaving unwanted words behind when tinkering with a sentence... Thanks! >>>> @@ -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 :) Done.