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

[Xen-devel] [PATCH 02 of 20] libxl: use keyword arguments for field definitions in aggregate types



# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1327336697 0
# Node ID 7a22673b930e5cc9dce8a1b43df4c4ca8daf49aa
# Parent  63146f3cd17e526c53496adeeddf5da90f13d2bc
libxl: use keyword arguments for field definitions in aggregate types.

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@xxxxxxxxxx>
Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>

diff -r 63146f3cd17e -r 7a22673b930e tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl       Mon Jan 23 16:38:17 2012 +0000
+++ b/tools/libxl/libxl_types.idl       Mon Jan 23 16:38:17 2012 +0000
@@ -196,7 +196,7 @@ libxl_domain_build_info = Struct("domain
                                       ("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),
                                       ])),
diff -r 63146f3cd17e -r 7a22673b930e tools/libxl/libxltypes.py
--- a/tools/libxl/libxltypes.py Mon Jan 23 16:38:17 2012 +0000
+++ b/tools/libxl/libxltypes.py Mon Jan 23 16:38:17 2012 +0000
@@ -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)
     #

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.