From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43966) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aw7Nq-0000xM-80 for qemu-devel@nongnu.org; Fri, 29 Apr 2016 08:19:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aw7N2-0005B0-6M for qemu-devel@nongnu.org; Fri, 29 Apr 2016 08:18:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57757) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aw7N1-000555-W7 for qemu-devel@nongnu.org; Fri, 29 Apr 2016 08:18:08 -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> <57234F4B.1010701@redhat.com> From: Eric Blake Message-ID: <572350F4.7090700@redhat.com> Date: Fri, 29 Apr 2016 06:17:56 -0600 MIME-Version: 1.0 In-Reply-To: <57234F4B.1010701@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="DaD9NwLxwRaKB1vaxBo8GBrsFovBrGKBa" 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) --DaD9NwLxwRaKB1vaxBo8GBrsFovBrGKBa Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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. >> >=20 > Yes, sounds better. Spoke too soon: "see commit since 08f9541" is too wordy, should be either "see commit 08f9541" or "since commit 08f9541" >=20 >=20 >>> @@ -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); >> >> Could assert(v->start_alternate && !err !=3D !*obj), to preempt "what = if >> !v->start_alternate" worries. If you like that, I can do it on commit= =2E >=20 > Can't hurt :) >=20 --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --DaD9NwLxwRaKB1vaxBo8GBrsFovBrGKBa 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/ iQEcBAEBCAAGBQJXI1D0AAoJEKeha0olJ0NqEpwH/26yqsd04jUGcDGdRokE0Rak D1S9Rt0Zqc04ar452AuHxcbHZkYDc+FQ/s+IUFhAAze5j4XKlbuxM8akSSwGSJ5R yq+jb/WBoHLod+ALmcU8XW/cdlgrKBX8uk15LDVaKQZ8tmE5r+mjSBRuv7QPJAnU zEH5fryKfjoImLyxgMA8pGoYCtIJ08gIUSP1O+5L1S2mxGnmxs2vXvsqmnU/S6s4 lLAgg6nYiVJlbv4VGK1zT4IaNVvUoeF3y3Cf4T9/GvoT+dD77YBeep/hrI54HYVe NQm0Z1NiXvPSkAFKVgirQ5NBNic1YB1tIUklo6g1HttW/0rvJ3cRL62Ok6wn2C4= =p4vR -----END PGP SIGNATURE----- --DaD9NwLxwRaKB1vaxBo8GBrsFovBrGKBa--