diff mbox series

[XEN,for-4.13,v2,2/4] libxl: gentypes.py: Break out field_pass in ..._copy_deprecated

Message ID 20191029155436.14376-3-ian.jackson@eu.citrix.com (mailing list archive)
State New, archived
Headers show
Series [XEN,for-4.13,v2,1/4] tools/libxl: gentypes.py: Prefer init_val to init_fn | expand

Commit Message

Ian Jackson Oct. 29, 2019, 3:54 p.m. UTC
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>
---
 tools/libxl/gentypes.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Anthony PERARD Oct. 30, 2019, 10:49 a.m. UTC | #1
On Tue, Oct 29, 2019 at 03:54:34PM +0000, Ian Jackson wrote:
> 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>

Acked-by: Anthony PERARD <anthony.perard@citrix.com>
diff mbox series

Patch

diff --git a/tools/libxl/gentypes.py b/tools/libxl/gentypes.py
index 1769121468..62883acb2e 100644
--- a/tools/libxl/gentypes.py
+++ b/tools/libxl/gentypes.py
@@ -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,