qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH RFC v3 31/32] qapi-introspect: Map all integer types


From: Markus Armbruster
Subject: [Qemu-devel] [PATCH RFC v3 31/32] qapi-introspect: Map all integer types to 'int'
Date: Tue, 4 Aug 2015 17:58:15 +0200

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 85KiB.

Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
---
 scripts/qapi-introspect.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/scripts/qapi-introspect.py b/scripts/qapi-introspect.py
index 8354d06..05d30e5 100644
--- a/scripts/qapi-introspect.py
+++ b/scripts/qapi-introspect.py
@@ -72,6 +72,13 @@ const char %(c_name)s[] = %(c_string)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
-- 
2.4.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]