From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60119) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XSGhT-0003uY-3A for qemu-devel@nongnu.org; Thu, 11 Sep 2014 22:35:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XSGhN-00017r-OC for qemu-devel@nongnu.org; Thu, 11 Sep 2014 22:35:03 -0400 Message-ID: <54125BCD.7050602@redhat.com> Date: Thu, 11 Sep 2014 20:34:53 -0600 From: Eric Blake MIME-Version: 1.0 References: <1410477659-9163-1-git-send-email-mdroth@linux.vnet.ibm.com> <1410477659-9163-3-git-send-email-mdroth@linux.vnet.ibm.com> In-Reply-To: <1410477659-9163-3-git-send-email-mdroth@linux.vnet.ibm.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="sl3uqfbjTaCMMFWHQvcqBGgBfFJObqa87" Subject: Re: [Qemu-devel] [PATCH 2/3] qapi: dealloc visitor, implement visit_start_union List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Michael Roth , qemu-devel@nongnu.org Cc: pbonzini@redhat.com, lcapitulino@redhat.com, famz@redhat.com, qemu-stable@nongnu.org, armbru@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --sl3uqfbjTaCMMFWHQvcqBGgBfFJObqa87 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 09/11/2014 05:20 PM, Michael Roth wrote: > If the .data field of a QAPI Union is NULL, we don't need to free > any of the union fields.. intentional double dot? >=20 > Make use of the new visit_start_union interface to access this > information and instruct the generated code to not visit these > fields when this occurs. >=20 > Cc: qemu-stable@nongnu.org > Reported-by: Fam Zheng > Suggested-by: Paolo Bonzini > Signed-off-by: Michael Roth > --- > qapi/qapi-dealloc-visitor.c | 6 ++++++ > 1 file changed, 6 insertions(+) >=20 > diff --git a/qapi/qapi-dealloc-visitor.c b/qapi/qapi-dealloc-visitor.c > index dc53545..eb77078 100644 > --- a/qapi/qapi-dealloc-visitor.c > +++ b/qapi/qapi-dealloc-visitor.c > @@ -162,6 +162,11 @@ static void qapi_dealloc_type_enum(Visitor *v, int= *obj, const char *strings[], > { > } > =20 > +static bool qapi_dealloc_start_union(Visitor *v, bool data_present, Er= ror **errp) Long line. > +{ > + return data_present; Okay, so this is a case where you can return false without setting errp. It would be nice to document the interactions and contract of this visitor here or in patch 1. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --sl3uqfbjTaCMMFWHQvcqBGgBfFJObqa87 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 iQEcBAEBCAAGBQJUElvNAAoJEKeha0olJ0NqlTUH/1P61KBHJ4lNVTvu1QTiciA6 bkSr9P0bENpOueK2bxRdJWmTlKBzlv/azk3JN2u+5pK1552X6XVxf6McrosuU/pP NJGz4e8ddFz7seR5p8vcPOnPvOht11l+AlHXfQO1w1TBQT8tyN9hKUbL6WIdyEEE qBEKwA5NTAMedYJj2ySpB3PH6dYeuF7fIHU0/F/NWdI3p8vph0zuXt6KMak3WxKr Lzw3L+DInWJnY6hszASCVehjfSB/MU0XSZUbSoAO5G3iXkkg+Dsts/yZawrib+gX Ycdhyy0dPsPt7T8crJQ+3uQd+qBT16h9gN4HVMuELzXjbBQriytbGtMI1ECDpk4= =pEBN -----END PGP SIGNATURE----- --sl3uqfbjTaCMMFWHQvcqBGgBfFJObqa87--