]> xenbits.xensource.com Git - people/sstabellini/xen-unstable.git/.git/commitdiff
libxl: gentypes.py: Break out field_pass in ..._copy_deprecated
authorIan Jackson <ian.jackson@eu.citrix.com>
Tue, 29 Oct 2019 15:17:58 +0000 (15:17 +0000)
committerIan Jackson <ian.jackson@eu.citrix.com>
Tue, 19 Nov 2019 16:33:56 +0000 (16:33 +0000)
We are going to want this in a moment.

No functional change with existing types: C output is identical.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Release-acked-by: Juergen Gross <jgross@suse.com>
Acked-by: Anthony PERARD <anthony.perard@citrix.com>
tools/libxl/gentypes.py

index 1769121468de286bcb190bea200f4e8c04531bf6..62883acb2e415f77be727fb65226b8a64cb062a2 100644 (file)
@@ -287,10 +287,10 @@ def libxl_C_type_copy_deprecated(field, v, indent = "    ", vparent = None):
         if field.type.check_default_fn is None:
             raise Exception(
 "Deprecated field %s type doesn't have a default value checker" % field.name)
-        field_val = field.type.pass_arg(v, vparent is None,
-                                        passby=idl.PASS_BY_VALUE)
-        field_ptr = field.type.pass_arg(v, vparent is None,
-                                        passby=idl.PASS_BY_REFERENCE)
+        field_pass = lambda by: field.type.pass_arg(v, vparent is None,
+                                                    passby=by)
+        field_val = field_pass(idl.PASS_BY_VALUE)
+        field_ptr = field_pass(idl.PASS_BY_REFERENCE)
         s+= "if (!%s(&p->%s) && !%s(%s))\n" % (field.type.check_default_fn,
                                                field.deprecated_by,
                                                field.type.check_default_fn,