]> xenbits.xensource.com Git - people/sstabellini/xen-unstable.git/.git/commitdiff
tools/libxl: gentypes.py: Prefer init_val to init_fn
authorIan Jackson <ian.jackson@eu.citrix.com>
Tue, 29 Oct 2019 15:00:35 +0000 (15:00 +0000)
committerIan Jackson <ian.jackson@eu.citrix.com>
Tue, 19 Nov 2019 16:33:43 +0000 (16:33 +0000)
When both are provided, init_val is likely to be more direct.

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 6417c9dd8cf0a054709cf4c0a4291657016940c9..1769121468de286bcb190bea200f4e8c04531bf6 100644 (file)
@@ -311,10 +311,10 @@ def libxl_C_type_copy_deprecated(field, v, indent = "    ", vparent = None):
                                    field.type.pass_arg(v, vparent is None))
 
         s+= "    "
-        if field.type.init_fn is not None:
-            s+= "%s(%s);\n" % (field.type.init_fn, field_ptr)
-        elif field.type.init_val is not None:
+        if field.type.init_val is not None:
             s+= "%s = %s;\n" % (field_val, field.type.init_val)
+        elif field.type.init_fn is not None:
+            s+= "%s(%s);\n" % (field.type.init_fn, field_ptr)
         else:
             s+= "memset(%s, 0, sizeof(*%s));\n" % (field_ptr, field_ptr)