From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39441) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aw7GN-0006zQ-P3 for qemu-devel@nongnu.org; Fri, 29 Apr 2016 08:11:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aw7GB-0002Z3-Pz for qemu-devel@nongnu.org; Fri, 29 Apr 2016 08:11:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46402) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aw7GB-0002WD-JX for qemu-devel@nongnu.org; Fri, 29 Apr 2016 08:11:03 -0400 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> From: Eric Blake Message-ID: <57234F4B.1010701@redhat.com> Date: Fri, 29 Apr 2016 06:10:51 -0600 MIME-Version: 1.0 In-Reply-To: <87eg9o7r95.fsf@dusky.pond.sub.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="vGdSg1h74eEqc2oO560a8lvPkE2J69oFm" 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: Markus Armbruster Cc: qemu-devel@nongnu.org, Michael Roth This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --vGdSg1h74eEqc2oO560a8lvPkE2J69oFm Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 04/29/2016 02:28 AM, Markus Armbruster wrote: > Eric Blake writes: >=20 >> 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). >=20 > Multiple sentences in a parenthesis, ugh :) >=20 > 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). >=20 > Can touch up on commit. >=20 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 =3D NULL; >> + >> assert(obj && size >=3D 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 =3D=3D VISITOR_INPUT) { >> + assert(!err !=3D !*obj); >=20 > Could assert(v->start_alternate && !err !=3D !*obj), to preempt "what i= f > !v->start_alternate" worries. If you like that, I can do it on commit.= Can't hurt :) --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --vGdSg1h74eEqc2oO560a8lvPkE2J69oFm Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJXI09LAAoJEKeha0olJ0NqBfAIAJ+JS7V7PnPZ8n9r+p6/nay7 sQtC+dOsq9Kz7SIDrXLzcVrsfPju6uvL44oQAQ2SbbwCy5ugUD0mvMwLvE5Xu9bU tVeS4BH2QI3m4KkP3wqo0p1t59oSlY74dbeZh/be6pwlnn0myar6ytzUd77G6rxQ 0qRrGfv+DRsAIwFtsGfnbrw0ZEY+yJ2SKSTCK16FxjFHQT3Oz5DAyWoAP8Xa043Q 4JnD8/A71m1OyP7iRzSrJtRliks6R0qQda97ad6wXOtp07Z2Fd3W/WhX9fTjWWZU GfRocahXUguVeaE9iGu7sk617pYJKkQLAEBjwlPNjbsxHYCBvs7GKTg/vN8oQyg= =+OpI -----END PGP SIGNATURE----- --vGdSg1h74eEqc2oO560a8lvPkE2J69oFm--