From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46586) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zvqpr-0004wP-TF for qemu-devel@nongnu.org; Mon, 09 Nov 2015 13:06:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zvqpm-0005Qa-AI for qemu-devel@nongnu.org; Mon, 09 Nov 2015 13:06:31 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48453) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zvqpm-0005QQ-4r for qemu-devel@nongnu.org; Mon, 09 Nov 2015 13:06:26 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id A889BDA2 for ; Mon, 9 Nov 2015 18:06:25 +0000 (UTC) References: <1447091204-10226-1-git-send-email-armbru@redhat.com> <1447091204-10226-8-git-send-email-armbru@redhat.com> From: Eric Blake Message-ID: <5640E098.5090701@redhat.com> Date: Mon, 9 Nov 2015 11:06:16 -0700 MIME-Version: 1.0 In-Reply-To: <1447091204-10226-8-git-send-email-armbru@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="TqbjxdRdCePcKaltDSWspXuD7oM6u3uac" Subject: Re: [Qemu-devel] [PULL 07/12] qapi: Simplify error cleanup in test-qmp-* List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster , qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --TqbjxdRdCePcKaltDSWspXuD7oM6u3uac Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 11/09/2015 10:46 AM, Markus Armbruster wrote: > From: Eric Blake >=20 > We have several tests that perform multiple sub-actions that are > expected to fail. Asserting that an error occurred, then clearing > it up to prepare for the next action, turned into enough > boilerplate that it was sometimes forgotten (for example, a number > of tests added to test-qmp-input-visitor.c in d88f5fd leaked err). > Worse, if an error is not reset to NULL, we risk invalidating > later use of that error (passing a non-NULL err into a function > is generally a bad idea). Encapsulate the boilerplate into a > single helper function error_free_or_abort(), and consistently > use it. >=20 > The new function is added into error.c for use everywhere, > although it is anticipated that testsuites will be the main > client. >=20 > Signed-off-by: Eric Blake > Signed-off-by: Markus Armbruster > --- > +++ b/include/qapi/error.h > @@ -30,6 +30,10 @@ > * Handle an error without reporting it (just for completeness): > * error_free(err); > * > + * Assert than an expected error occurred, but clean it up without > + * reporting it (primarily useful in testsuites): s/than/that/ (if the pull hasn't already gone through; otherwise it's a trivial followup) --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --TqbjxdRdCePcKaltDSWspXuD7oM6u3uac 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/ iQEcBAEBCAAGBQJWQOCYAAoJEKeha0olJ0NqvFkH/0YelTKEVbZRkAkmDAyt5+Zv Ex/W7NqKJI2CIxN1udX0ukQk71BfwAvPpKIStXMno6ltZQyA6eAM+YJNaxbINLUw K1dmLsxVRfeo2sRpGboTWu6IAyUa6NGB/RAa3qZFkmY7njC+UelscZ8fnr8um7eL 6t8NNhqZcI872Jx/iuEU2+c4cRCc0OnK8IAlmb9cOb5ab0CzMJQxZGSbvmIfH3pl B7s2LJN81JGZrt79FbyaGnGzb1JmYPK4AUuVfHcmbzWbPY8gaU7ABH462QLJ8t+0 WipS1NlIc6HdP9BFJpxvEPjLtx9cgf8Nd38F0IwG0QHibTdL34t9+AGcNqILc+4= =TEGl -----END PGP SIGNATURE----- --TqbjxdRdCePcKaltDSWspXuD7oM6u3uac--