tools/libxl: gentypes.py: Prefer init_val to init_fn

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>
This commit is contained in:
Ian Jackson committed 2019-11-19 16:33:43 +00:00
1 parent e28eed55a4
commit 3afbd233c9
1 file changed
+3 -3
+3 -3
View 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)
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.