libxl: use keyword arguments for field definitions in aggregate types.
authorIan Campbell <ian.campbell@citrix.com>
Tue, 31 Jan 2012 14:39:57 +0000 (14:39 +0000)
committerIan Campbell <ian.campbell@citrix.com>
Tue, 31 Jan 2012 14:39:57 +0000 (14:39 +0000)
The original code is not so bad now that the comments are gone but this is
still a bit cleaner.

No change in the generated code.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
tools/libxl/libxl_types.idl
tools/libxl/libxltypes.py

index 556f3fca3f3cf430a11ff38e1dc7098d59767b0c..dbafa395e8ae813fb1d15e48390628a719c19cbd 100644 (file)
@@ -192,7 +192,7 @@ libxl_domain_build_info = Struct("domain_build_info",[
                                       ("bootloader_args", libxl_string_list),
                                       ("cmdline", string),
                                       ("ramdisk", libxl_file_reference),
-                                      ("features", string, True),
+                                      ("features", string, {'const': True}),
                                       # Use host's E820 for PCI passthrough.
                                       ("e820_host", bool),
                                       ])),
index 338cfdeee9bae789bd9144bc1713e4fb10cb637a..880b7ca71d88bca1bba00cc5aced7e71c936d470 100644 (file)
@@ -154,17 +154,17 @@ class Aggregate(Type):
 
         self.fields = []
         for f in fields:
-            # (name, type[, const=False])
+            # (name, type[, {kw args}])
             if len(f) == 2:
                 n,t = f
-                const = False
+                kw = {}
             elif len(f) == 3:
-                n,t,const = f
+                n,t,kw = f
             else:
                 raise ValueError
             if n is None:
                 raise ValueError
-            self.fields.append(Field(t,n,const=const))
+            self.fields.append(Field(t,n,**kw))
 
     # Returns a tuple (stem, field-expr)
     #