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

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



# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1326190542 0
# Node ID cf86bcb7c89568a2c60f246d0e2443acb756e1c1
# Parent  485945937a27ea1d9736b8f9bf8d21183b928780
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>

diff -r 485945937a27 -r cf86bcb7c895 tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl       Tue Jan 10 10:15:42 2012 +0000
+++ b/tools/libxl/libxl_types.idl       Tue Jan 10 10:15:42 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 485945937a27 -r cf86bcb7c895 tools/libxl/libxltypes.py
--- a/tools/libxl/libxltypes.py Tue Jan 10 10:15:42 2012 +0000
+++ b/tools/libxl/libxltypes.py Tue Jan 10 10:15:42 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®.