From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45150) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WhQgD-0002sj-KO for qemu-devel@nongnu.org; Mon, 05 May 2014 17:44:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WhQg8-0000ZV-Ed for qemu-devel@nongnu.org; Mon, 05 May 2014 17:44:09 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39872) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WhQg8-0000ZJ-7c for qemu-devel@nongnu.org; Mon, 05 May 2014 17:44:04 -0400 Message-ID: <5368061D.9090201@redhat.com> Date: Mon, 05 May 2014 15:43:57 -0600 From: Eric Blake MIME-Version: 1.0 References: <1399034675-17844-1-git-send-email-armbru@redhat.com> <1399034675-17844-13-git-send-email-armbru@redhat.com> In-Reply-To: <1399034675-17844-13-git-send-email-armbru@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="FVaaXdG55wv59SNKhoo8gn6LGaJbtBbmc" Subject: Re: [Qemu-devel] [PATCH 12/13] qapi: Replace uncommon use of the error API by the common one List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster , qemu-devel@nongnu.org Cc: vilanova@ac.upc.edu, pbonzini@redhat.com, akong@redhat.com, mdroth@linux.vnet.ibm.com, lcapitulino@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --FVaaXdG55wv59SNKhoo8gn6LGaJbtBbmc Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 05/02/2014 06:44 AM, Markus Armbruster wrote: > We commonly use the error API like this: >=20 > However, mixing the two techniques is confusing. You can't use the > "accumulate" technique with functions designed for the "check > separately" technique. You can use the "check separately" technique > with functions designed for the "accumulate" technique, but then > error_set() can't catch you setting an error more than once. Nice comparison of the two techniques. >=20 > Standardize on the "check separately" technique for now, because it's > overwhelmingly prevalent. >=20 > Signed-off-by: Markus Armbruster > --- > +++ b/hw/virtio/virtio-balloon.c > @@ -121,23 +121,27 @@ static void balloon_stats_get_all(Object *obj, st= ruct Visitor *v, > visit_start_struct(v, NULL, NULL, "stats", 0, &err); > if (err) { > goto out_end; > } > - =20 > - for (i =3D 0; i < VIRTIO_BALLOON_S_NR; i++) { > + for (i =3D 0; err && i < VIRTIO_BALLOON_S_NR; i++) { Oops; logic error makes this loop dead code. s/err/!err/ > @@ -502,7 +503,7 @@ fdecl.write(mcgen(''' > /* THIS FILE IS AUTOMATICALLY GENERATED, DO NOT MODIFY */ > =20 > /* > - * schema-defined QAPI visitor function > + * schema-defined QAPI visitor functions Unrelated typo fix; could go in separately via -trivial if you were so inclined, but I don't mind it going in here. If the logic error is the only fix, Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --FVaaXdG55wv59SNKhoo8gn6LGaJbtBbmc Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJTaAYdAAoJEKeha0olJ0NqVi8IAKY1BNBVAQSXy1pQkmngmTLU vOnwTURevQpXV77opA+Q4cOAWcIqY4xnPflHflOkCQWiFnCbjKze+RXhRWr7+8EA p+fSiUfXZcRP8YZf+rXzFi5qVLYUvx/E/M3j/Ng+QQvcGwhQcAo1Dx3ny/CBOdDz qcSZFvXTWpw33xzvhbtaYsZ1UYgttedq19kJaFZcGGtX0fme3rEh8iUhO4tQ1coL uDw6cUc63iUp/16lftVfX+yi5HC3o3J7IY9UCD3CjjLbqNzzGFFLuEnX8AHo08e3 mW2ZJx1zQjL3ihqAbWaLoqP82PV9qMVD+KYeQ74QW8BP69LvCL18QBLu/7oqthI= =T7fz -----END PGP SIGNATURE----- --FVaaXdG55wv59SNKhoo8gn6LGaJbtBbmc--