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

[Xen-devel] [XEN PATCH for-4.13 v2 1/4] tools/libxl: gentypes.py: Prefer init_val to init_fn


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
  • Date: Tue, 29 Oct 2019 15:54:33 +0000
  • Authentication-results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=ian.jackson@xxxxxxxxxxxxx; spf=Pass smtp.mailfrom=Ian.Jackson@xxxxxxxxxx; spf=None smtp.helo=postmaster@xxxxxxxxxxxxxxx
  • Cc: Jürgen Groß <jgross@xxxxxxxx>, Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
  • Delivery-date: Tue, 29 Oct 2019 15:54:54 +0000
  • Ironport-sdr: kZQHK4Fg/REBOKWpp9fCJVjiShjpzqupChtCGODR/Gd17ds8+YO3srk8AQkPQzkfrk97q4ypv6 z3uhHQaywKq3iifnBR/yymAwHh2lp21Pem7iJc8ZiuXO+zxXDZSwMGGy0XneutYjP7reacT0Dz YRxwiLoTe2iF/Vr1GXFUV+9zgveVPhIohOZaDE+7Q7OxMPFpPzRxKcJvjQL1vpADtNoRTZUZ9c eFNLpPwtAnEodK+/vvn7+kLbiICUSg5aUdRnYz2GRUiUMV91cQm1HmEDJkMdIjiHempOeDkY2a KdY=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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@xxxxxxxxxxxxx>
---
 tools/libxl/gentypes.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/libxl/gentypes.py b/tools/libxl/gentypes.py
index 6417c9dd8c..1769121468 100644
--- a/tools/libxl/gentypes.py
+++ b/tools/libxl/gentypes.py
@@ -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)
 
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.