From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52462) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLvAF-0005HN-DN for qemu-devel@nongnu.org; Wed, 20 Jan 2016 10:59:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aLvAC-0000b9-8P for qemu-devel@nongnu.org; Wed, 20 Jan 2016 10:59:19 -0500 Received: from mx1.redhat.com ([209.132.183.28]:56693) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLvAC-0000b5-2I for qemu-devel@nongnu.org; Wed, 20 Jan 2016 10:59:16 -0500 References: <1453219845-30939-1-git-send-email-eblake@redhat.com> <1453219845-30939-3-git-send-email-eblake@redhat.com> <87egdczhwh.fsf@blackfin.pond.sub.org> From: Eric Blake Message-ID: <569FAED2.3060609@redhat.com> Date: Wed, 20 Jan 2016 08:59:14 -0700 MIME-Version: 1.0 In-Reply-To: <87egdczhwh.fsf@blackfin.pond.sub.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="NEhaplf49DC4Qx4nb2GK9hSJbWvJAIgjL" Subject: Re: [Qemu-devel] [PATCH v9 02/37] qapi: Avoid use of misnamed DO_UPCAST() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: marcandre.lureau@redhat.com, qemu-devel@nongnu.org, Michael Roth This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --NEhaplf49DC4Qx4nb2GK9hSJbWvJAIgjL Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 01/20/2016 03:04 AM, Markus Armbruster wrote: > Eric Blake writes: >=20 >> The macro DO_UPCAST() is incorrectly named: it converts from a >> parent class to a derived class (which is a downcast). Better, >> and more consistent with some of the other qapi visitors, is >> to use the container_of() macro through a to_FOO() helper. >> >> Our current definition of container_of() is weaker than >> DO_UPCAST(), in that it does not require the derived class to >> have Visitor as its first member, but this does not hurt our >> usage patterns in qapi visitors. >> >> Signed-off-by: Eric Blake >> Reviewed-by: Marc-Andr=C3=A9 Lureau >> >> >> +static OptsVisitor *to_ov(Visitor *v) >> +{ >> + return container_of(v, OptsVisitor, visitor); >> +} >> + >> + >=20 > The name to_ov() is rather laconic even for my taste. Tolerable, since= > it's static. And matches existing practice pre-patch: qapi/qapi-dealloc-visitor.c:static QapiDeallocVisitor *to_qov(Visitor *v)= qapi/qmp-input-visitor.c:static QmpInputVisitor *to_qiv(Visitor *v) qapi/qmp-output-visitor.c:static QmpOutputVisitor *to_qov(Visitor *v) >=20 > Patch gets rid of all DO_UPCAST() in qapi/. PATCH 33 brings one back; > it should use to_ov() instead. D'oh. You can tell what order I wrote the patches in :) If I need to respin, I'll fix it; otherwise, I assume you can handle it. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --NEhaplf49DC4Qx4nb2GK9hSJbWvJAIgjL 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/ iQEcBAEBCAAGBQJWn67SAAoJEKeha0olJ0Nq56gIAJs9IkHQVGkEmj0ZH65TgxQx ZMLVzXTTx28r9Ip0JvUUTi4qBi5kQYFPbMC4PQPeAmaVj32mpBoK6N6iUb3dkgGw oBPgrmYXJgPeP6A+yEsfRp7TxQkZ2LfkVo5yXR8OP7gxxVN5eLGUgd9rk+hMa397 pG4vHKqS5UWCbRev4BlSo+rdW+nScIGpOUgmUNHkE6mCqsbnlGwePYFLy3qzAiLO 6YIgnF0R49YN3wHA5FhDd9Zh3YqpYq4FSavd7pvq1dxixqOg3dnhXVXn5KmZw+iS AFfCbqW6LuYO87sGJWXbQ7J1OmzaGMiPTOQGdbKVJUnPmVMr1HNV9+m2KYssgpU= =yZxQ -----END PGP SIGNATURE----- --NEhaplf49DC4Qx4nb2GK9hSJbWvJAIgjL--