From: Ian Campbell Subject: [PATCH 02 of 32 RFC] libxl: use keyword arguments for field definitions in aggregate types Date: Mon, 16 Jan 2012 12:15:00 +0000 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com Cc: ian.jackson@citrix.com List-Id: xen-devel@lists.xenproject.org # HG changeset patch # User Ian Campbell # 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 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) #