aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxl/gentypes.py
diff options
context:
space:
mode:
authorIan Campbell <ian.campbell@citrix.com>2011-04-20 17:13:07 +0100
committerIan Campbell <ian.campbell@citrix.com>2011-04-20 17:13:07 +0100
commitca70c225c4f5c47fd1b5399140004999bc268365 (patch)
tree18b83369bce2b921f937ba1afb48fad3a6d732fb /tools/libxl/gentypes.py
parent59f8f46a491c9bdc1ad3e0c5ae4f8b48068d13cd (diff)
downloadxen-ca70c225c4f5c47fd1b5399140004999bc268365.tar.gz
xen-ca70c225c4f5c47fd1b5399140004999bc268365.tar.bz2
xen-ca70c225c4f5c47fd1b5399140004999bc268365.zip
tools: libxl: remove Reference meta-type from IDL
It is tricky to map to language bindings and is now unused in any case. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Ian Jackson <ian.jackson.citrix.com> Committed-by: Ian Jackson <ian.jackson.citrix.com>
Diffstat (limited to 'tools/libxl/gentypes.py')
-rw-r--r--tools/libxl/gentypes.py18
1 files changed, 7 insertions, 11 deletions
diff --git a/tools/libxl/gentypes.py b/tools/libxl/gentypes.py
index b64ec0ccb2..e764e200af 100644
--- a/tools/libxl/gentypes.py
+++ b/tools/libxl/gentypes.py
@@ -78,13 +78,13 @@ def libxl_C_type_define(ty, indent = ""):
raise NotImplementedError("%s" % type(ty))
return s.replace("\n", "\n%s" % indent)
-def libxl_C_type_destroy(ty, v, reference, indent = " ", parent = None):
- if reference:
+def libxl_C_type_destroy(ty, v, indent = " ", parent = None):
+ if parent is None:
deref = v + "->"
else:
deref = v + "."
- if ty.passby == libxltypes.PASS_BY_REFERENCE and not reference:
+ if ty.passby == libxltypes.PASS_BY_REFERENCE and parent is not None:
makeref = "&"
else:
makeref = ""
@@ -96,19 +96,15 @@ def libxl_C_type_destroy(ty, v, reference, indent = " ", parent = None):
for f in ty.fields:
keyvar_expr = f.keyvar_expr % (parent + ty.keyvar_name)
s += "if (" + keyvar_expr + ") {\n"
- s += libxl_C_type_destroy(f.type, deref + f.name, False, indent + " ", deref)
+ s += libxl_C_type_destroy(f.type, deref + f.name, indent + " ", deref)
s += "}\n"
- elif isinstance(ty, libxltypes.Reference):
- s += libxl_C_type_destroy(ty.ref_type, v, True, indent, v)
- if ty.destructor_fn is not None:
- s += "%s(%s);\n" % (ty.destructor_fn, makeref + v)
elif isinstance(ty, libxltypes.Struct) and (parent is None or ty.destructor_fn is None):
for f in [f for f in ty.fields if not f.const]:
if f.name is None: # Anonynous struct
- s += libxl_C_type_destroy(f.type, deref, False, "", deref)
+ s += libxl_C_type_destroy(f.type, deref, "", deref)
else:
- s += libxl_C_type_destroy(f.type, deref + f.name, False, "", deref)
+ s += libxl_C_type_destroy(f.type, deref + f.name, "", deref)
else:
if ty.destructor_fn is not None:
s += "%s(%s);\n" % (ty.destructor_fn, makeref + v)
@@ -177,7 +173,7 @@ if __name__ == '__main__':
for ty in [t for t in types if t.destructor_fn is not None and t.autogenerate_destructor]:
f.write("void %s(%s *p)\n" % (ty.destructor_fn, ty.typename))
f.write("{\n")
- f.write(libxl_C_type_destroy(ty, "p", True))
+ f.write(libxl_C_type_destroy(ty, "p"))
f.write(" memset(p, LIBXL_DTOR_POISON, sizeof(*p));\n")
f.write("}\n")
f.write("\n")