[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH RFC v2 46/47] qapi-introspect: Map all integer t
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH RFC v2 46/47] qapi-introspect: Map all integer types to 'int' |
Date: |
Thu, 23 Jul 2015 21:33:05 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 |
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.
>
> 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.
>
> Signed-off-by: Markus Armbruster <address@hidden>
> ---
> scripts/qapi-introspect.py | 7 +++++++
> 1 file changed, 7 insertions(+)
Reviewed-by: Eric Blake <address@hidden>
>
> 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[] = "["
> self.used_types = None
>
> def _use_type(self, typ):
> + # Map the various integer types to plain int
> + if typ.json_type() == 'int':
> + typ = self.schema.lookup_type('int')
> + elif isinstance(typ, QAPISchemaArrayType) \
> + and typ.element_type.json_type() == 'int':
> + typ = 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
>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- Re: [Qemu-devel] [PATCH RFC v2 38/47] qapi-commands: De-duplicate output marshaling functions, (continued)
- [Qemu-devel] [PATCH RFC v2 28/47] qapi-commands: Convert to QAPISchemaVisitor, Markus Armbruster, 2015/07/01
- [Qemu-devel] [PATCH RFC v2 43/47] qmp: Improve netdev_add usage example in the manual, Markus Armbruster, 2015/07/01
- [Qemu-devel] [PATCH RFC v2 42/47] qapi-schema: Fix up misleading specification of netdev_add, Markus Armbruster, 2015/07/01
- [Qemu-devel] [PATCH RFC v2 46/47] qapi-introspect: Map all integer types to 'int', Markus Armbruster, 2015/07/01
- Re: [Qemu-devel] [PATCH RFC v2 46/47] qapi-introspect: Map all integer types to 'int',
Eric Blake <=
- [Qemu-devel] [PATCH RFC v2 39/47] qapi: Improve built-in type documentation, Markus Armbruster, 2015/07/01
- [Qemu-devel] [PATCH RFC v2 35/47] qapi-commands: Rearrange code, Markus Armbruster, 2015/07/01
- [Qemu-devel] [PATCH RFC v2 21/47] qapi: New QAPISchema intermediate reperesentation, Markus Armbruster, 2015/07/01
- [Qemu-devel] [PATCH RFC v2 47/47] qapi-introspect: Hide type names, Markus Armbruster, 2015/07/01