From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53305) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zu7Ek-0008KD-4o for qemu-devel@nongnu.org; Wed, 04 Nov 2015 18:13:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zu7Eg-0004OS-3u for qemu-devel@nongnu.org; Wed, 04 Nov 2015 18:13:02 -0500 Received: from mx1.redhat.com ([209.132.183.28]:41570) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zu7Ef-0004ON-Su for qemu-devel@nongnu.org; Wed, 04 Nov 2015 18:12:58 -0500 References: <1446618049-13596-1-git-send-email-eblake@redhat.com> <1446618049-13596-21-git-send-email-eblake@redhat.com> <878u6dd1w0.fsf@blackfin.pond.sub.org> From: Eric Blake Message-ID: <563A90F8.4080703@redhat.com> Date: Wed, 4 Nov 2015 16:12:56 -0700 MIME-Version: 1.0 In-Reply-To: <878u6dd1w0.fsf@blackfin.pond.sub.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="XTRLoQDTCbCDIrH1auwHawMdxuxVJH12w" Subject: Re: [Qemu-devel] [PATCH v9 20/27] qapi: Simplify QAPISchemaObjectTypeVariants.check() 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) --XTRLoQDTCbCDIrH1auwHawMdxuxVJH12w Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 11/04/2015 12:02 PM, Markus Armbruster wrote: > Eric Blake writes: >=20 >> From: Markus Armbruster >> >> Avoid the 'if seen' conditional by doing just the essential work >> here, namely setting self.tag_member for flat unions. >> Move the rest to callers. >> >> Signed-off-by: Markus Armbruster >> Message-Id: <1446559499-26984-7-git-send-email-armbru@redhat.com> >> [reword commit, rebase to earlier AlternateType.check() changes] >> Signed-off-by: Eric Blake >> >> --- >> v9: new patch >> --- >> scripts/qapi.py | 5 ++--- >> 1 file changed, 2 insertions(+), 3 deletions(-) >> >> diff --git a/scripts/qapi.py b/scripts/qapi.py >> index 3054628..6653c70 100644 >> --- a/scripts/qapi.py >> +++ b/scripts/qapi.py >> @@ -988,9 +988,10 @@ class QAPISchemaObjectType(QAPISchemaType): >> for m in self.local_members: >> m.check(schema) >> m.check_clash(seen) >> + self.members =3D seen.values() >> if self.variants: >> self.variants.check(schema, seen) >> - self.members =3D seen.values() >> + assert self.variants.tag_member in self.members >> >> def is_implicit(self): >> # See QAPISchema._make_implicit_object_type() >> @@ -1053,8 +1054,6 @@ class QAPISchemaObjectTypeVariants(object): >> # seen is non-empty for unions, empty for alternates >=20 > You added this comment in PATCH 10 to explain the conditional I'm > dropping here. Let's drop the comment, too. Except the comment becomes relevant again in 23/27. Or maybe I just move the comment to that point. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --XTRLoQDTCbCDIrH1auwHawMdxuxVJH12w 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/ iQEcBAEBCAAGBQJWOpD4AAoJEKeha0olJ0Nqfb0IAJJ/qEv+Tc6NPSIpuCSL2L5p KbuUO0nvlqY7C7hSEVGlIp7fdAZzR+iFEG+IQpjTutb/zijzLuH1j+NQieVQ6I0w w0weFjjkSUeQLkZhWRDLA5KGvEVVCjs40lh0nXQCqacDnCDqWpruhz+UY4CvbA0B RLeoG+svo2VdwKkIe8eln3L7m90gkE/g6wOqtjFOuGBOOikQeBev4am7U1QKMcDt 1Ic1Tv1t1UPlZ0svxxdvOgM5eZcK8f4VoTsp04NAd+1pkIV4HAaiLtdLQzNoKYEV FenbdKXJzbAYAbzayg14ifHi4P40/O/6yHWUDukr3lkynK58etiJX6ZOtmbsIVA= =7zPw -----END PGP SIGNATURE----- --XTRLoQDTCbCDIrH1auwHawMdxuxVJH12w--