From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60721) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZITjS-0007kZ-Fk for qemu-devel@nongnu.org; Thu, 23 Jul 2015 23:33:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZITjP-0007pj-Ad for qemu-devel@nongnu.org; Thu, 23 Jul 2015 23:33:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50487) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZITjP-0007p9-4A for qemu-devel@nongnu.org; Thu, 23 Jul 2015 23:33:07 -0400 References: <1435782155-31412-1-git-send-email-armbru@redhat.com> <1435782155-31412-47-git-send-email-armbru@redhat.com> From: Eric Blake Message-ID: <55B1B1F1.5070902@redhat.com> Date: Thu, 23 Jul 2015 21:33:05 -0600 MIME-Version: 1.0 In-Reply-To: <1435782155-31412-47-git-send-email-armbru@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="LnlCgEwtQwc5E78pjIt5Se5pQ9vQv9LvC" Subject: Re: [Qemu-devel] [PATCH RFC v2 46/47] qapi-introspect: Map all integer types to 'int' List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster , qemu-devel@nongnu.org Cc: kwolf@redhat.com, berto@igalia.com, mdroth@linux.vnet.ibm.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --LnlCgEwtQwc5E78pjIt5Se5pQ9vQv9LvC Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 07/01/2015 02:22 PM, Markus Armbruster wrote: > How many bits we use internally is an implementation detail. It could > be pressed into external interface service as a very approximate range > information, but that's probably a bad idea. If we need range > information, we better do it properly. >=20 > Reduces output of query-schema by a negligible 0.5 out of 80KiB. But also makes us more conservative - it's easier to add things later than to be forced to support forever; and mapping everything to 'int' in introspection lets us change from 'int8' to 'uint8' internally without affecting introspection-visible API. I'm in favor of this for more than just the string size savings. >=20 > Signed-off-by: Markus Armbruster > --- > scripts/qapi-introspect.py | 7 +++++++ > 1 file changed, 7 insertions(+) Reviewed-by: Eric Blake >=20 > diff --git a/scripts/qapi-introspect.py b/scripts/qapi-introspect.py > index e7efc4a..961fe88 100644 > --- a/scripts/qapi-introspect.py > +++ b/scripts/qapi-introspect.py > @@ -46,6 +46,13 @@ char %(c_name)s[] =3D "[" > self.used_types =3D None > =20 > def _use_type(self, typ): > + # Map the various integer types to plain int > + if typ.json_type() =3D=3D 'int': > + typ =3D self.schema.lookup_type('int') > + elif isinstance(typ, QAPISchemaArrayType) \ > + and typ.element_type.json_type() =3D=3D 'int': > + typ =3D self.schema.lookup_type('intList') > + # Add type to work queue if new > if typ not in self.used_types: > self.used_types.append(typ) > return typ.name >=20 --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --LnlCgEwtQwc5E78pjIt5Se5pQ9vQv9LvC 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/ iQEcBAEBCAAGBQJVsbHxAAoJEKeha0olJ0NqU60H/1czUW7mFquAc7Yp2lgKgmQI KS1xW552TqSCglM6Qc8B8yO4FpZ6OjCrkklb1X6zCmXNM5t2KPryoCvQSQboRAkA fW+gv58/48T1xzQCkEiBhBlz5q3RKH10+xyvBqDWDzH/BT7y74GLXo6D2bY2IjKq SISobJpptz5pLVc7v6AahbOoktGIcpKerdvIGazoK98lDy5mUIUkve3CzMzhXRva iLiDlTDEV/tD2O5Z3ZL2UEQD/bAw1jbzFYrY+mxCAcH6uKQmy9c7yS4H7gyjHP3y gbJzRSVUL0CqmvmVn5s0Zth/brb9g7yBCDtKXzN0E538oENC7C7v6rbtnTHtN+k= =wvl0 -----END PGP SIGNATURE----- --LnlCgEwtQwc5E78pjIt5Se5pQ9vQv9LvC--