diff options
author | Ian Campbell <ian.campbell@citrix.com> | 2011-07-14 13:22:36 +0100 |
---|---|---|
committer | Ian Campbell <ian.campbell@citrix.com> | 2011-07-14 13:22:36 +0100 |
commit | 48db030b86f2a6d4ea5f1b5add47da23ca7b59e0 (patch) | |
tree | 563beb60195ef8826f34bb53582412d26b8f5474 /tools/libxl/gentypes.py | |
parent | 2cbaaf0d42a2160cd7b6ba6d6cc76aeb7199fd07 (diff) | |
download | xen-48db030b86f2a6d4ea5f1b5add47da23ca7b59e0.tar.gz xen-48db030b86f2a6d4ea5f1b5add47da23ca7b59e0.tar.bz2 xen-48db030b86f2a6d4ea5f1b5add47da23ca7b59e0.zip |
libxl: IDL: handle generation of pass-by-reference arguments.
Up until now everything with a destructor function happened to be
pass-by-reference so the current code worked but this will not be the case for
*_to_string and *_to_json. Put some infrastructure in place and use it.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
Diffstat (limited to 'tools/libxl/gentypes.py')
-rw-r--r-- | tools/libxl/gentypes.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/tools/libxl/gentypes.py b/tools/libxl/gentypes.py index 5abc2e212c..6d798738f2 100644 --- a/tools/libxl/gentypes.py +++ b/tools/libxl/gentypes.py @@ -178,10 +178,10 @@ if __name__ == '__main__': for ty in types: f.write(libxl_C_type_define(ty) + ";\n") if ty.destructor_fn is not None: - f.write("void %s(%s *p);\n" % (ty.destructor_fn, ty.typename)) + f.write("void %s(%s);\n" % (ty.destructor_fn, ty.make_arg("p"))) if isinstance(ty, libxltypes.Enumeration): - f.write("const char *%s_to_string(%s e);\n" % (ty.typename, ty.typename)) - f.write("int %s_from_string(const char *s, %s *e);\n" % (ty.typename, ty.typename)) + f.write("const char *%s_to_string(%s);\n" % (ty.typename, ty.make_arg("p"))) + f.write("int %s_from_string(const char *s, %s);\n" % (ty.typename, ty.make_arg("e", passby=libxltypes.PASS_BY_REFERENCE))) f.write("extern libxl_enum_string_table %s_string_table[];\n" % (ty.typename)) f.write("\n") @@ -213,7 +213,7 @@ if __name__ == '__main__': """ % " ".join(sys.argv)) 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("void %s(%s)\n" % (ty.destructor_fn, ty.make_arg("p"))) f.write("{\n") f.write(libxl_C_type_destroy(ty, "p")) f.write(" memset(p, LIBXL_DTOR_POISON, sizeof(*p));\n") |