From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53884) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZwdZy-0006dh-Bj for qemu-devel@nongnu.org; Wed, 11 Nov 2015 17:09:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZwdZv-0001Zn-45 for qemu-devel@nongnu.org; Wed, 11 Nov 2015 17:09:22 -0500 Received: from mx1.redhat.com ([209.132.183.28]:38606) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZwdZu-0001Zj-UW for qemu-devel@nongnu.org; Wed, 11 Nov 2015 17:09:19 -0500 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id 87A823CA970 for ; Wed, 11 Nov 2015 22:09:18 +0000 (UTC) References: <1447277273-26151-1-git-send-email-ehabkost@redhat.com> <1447277273-26151-3-git-send-email-ehabkost@redhat.com> From: Eric Blake Message-ID: <5643BC8D.9030505@redhat.com> Date: Wed, 11 Nov 2015 15:09:17 -0700 MIME-Version: 1.0 In-Reply-To: <1447277273-26151-3-git-send-email-ehabkost@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="xG5HKXPs1XrTLrUCqkctVD0mxsWVKSSRE" Subject: Re: [Qemu-devel] [PATCH 2/2] vl: Replace *_vga_available() functions with class_names field List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eduardo Habkost , qemu-devel@nongnu.org Cc: Paolo Bonzini This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --xG5HKXPs1XrTLrUCqkctVD0mxsWVKSSRE Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 11/11/2015 02:27 PM, Eduardo Habkost wrote: > Instead of requiring a separate function for each VGA interface, > just enumerate the corresponding class names on struct > VGAInterfaceInfo. >=20 > Signed-off-by: Eduardo Habkost > --- > vl.c | 70 +++++++++++++++++++++++-------------------------------------= -------- > 1 file changed, 23 insertions(+), 47 deletions(-) >=20 > [VGA_CG3] =3D { > .opt_name =3D "cg3", > .name =3D "CG3 framebuffer", > - .available =3D cg3_vga_available, > + .class_names =3D { "cgthree" }, > }, > [VGA_XENFB] =3D { > .opt_name =3D "xenfb", > }, > }; > =20 > +static bool vga_interface_available(VGAInterfaceType t) > +{ > + VGAInterfaceInfo *ti =3D &vga_interfaces[t]; > + > + assert(t < VGA_TYPE_MAX); > + return !ti->class_names[0] || > + object_class_by_name(ti->class_names[0]) || > + object_class_by_name(ti->class_names[1]); Does the correct thing when ti->class_names[1] is NULL (but I had to look= ). Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --xG5HKXPs1XrTLrUCqkctVD0mxsWVKSSRE 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/ iQEcBAEBCAAGBQJWQ7yNAAoJEKeha0olJ0Nq/IkH/RjMIqZJ8e+WJcVTGcDWl5Ro v7rtsefhJ8Ii58K930ffZfFYcH4dih2jd2akx8LKVxlMnV0twGRvdOv5l7nOTmNl 79/tbCsjj+vLmec2DZ1quAmfg04IpEzC47cnY5GwZzEU0h+tKicjKmJFQo39e4gT eVRjEMZN0+1r/kIs0EfHbhZH77cWO7nZmg6nEMh0imiRQqJkRS7hydpLrz/Hw8wv YhMDsPDibQwLf2IKn2aUsAmspcckPXh0ehvZVw4lr2gjXHzg+uXLNTc0SSHsdXJg JnILoPdgkuIs6Gpjc1JmG3VqIVeBIyQdoL9dUAgvfptV1euh7CqwzhTL0f8ieDE= =sEtK -----END PGP SIGNATURE----- --xG5HKXPs1XrTLrUCqkctVD0mxsWVKSSRE--