debuggers.hg

changeset 22081:1ba7cbf9683b

libxl: do not generate a destructor for data types which do not require one

libxl_dominfo, libxl_poolinfo, libxl_vminfo, libxl_domain_build_state,
libxl_physinfo and libxl_sched_credit contain no members which require
destruction so omit the auto generated destructor.

As an exception continue to generate destructors for libxl_device_*
and libxl_{devtype}* even if they have no interesting members so that
all device types can be treated the same without special knowledge
about the type contents being required.

[PATCH 08 of 16 of
libxl: autogenerate type definitions and destructor functions]

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
author Ian Campbell <ian.campbell@citrix.com>
date Thu Aug 19 15:24:41 2010 +0100 (2010-08-19)
parents 24f6507f0156
children ed717f785082
files tools/libxl/gentypes.py tools/libxl/libxl.idl
line diff
     1.1 --- a/tools/libxl/gentypes.py	Thu Aug 19 15:21:29 2010 +0100
     1.2 +++ b/tools/libxl/gentypes.py	Thu Aug 19 15:24:41 2010 +0100
     1.3 @@ -150,7 +150,7 @@ if __name__ == '__main__':
     1.4  
     1.5  """ % " ".join(sys.argv))
     1.6  
     1.7 -    for ty in [t for t in types if t.autogenerate_destructor]:
     1.8 +    for ty in [t for t in types if t.destructor_fn is not None and t.autogenerate_destructor]:
     1.9          f.write("void %s(%s *p)\n" % (ty.destructor_fn, ty.typename))
    1.10          f.write("{\n")
    1.11          f.write(libxl_C_type_destroy(ty, "p", True))
     2.1 --- a/tools/libxl/libxl.idl	Thu Aug 19 15:21:29 2010 +0100
     2.2 +++ b/tools/libxl/libxl.idl	Thu Aug 19 15:24:41 2010 +0100
     2.3 @@ -40,16 +40,16 @@ SHUTDOWN_* constant."""),
     2.4      ("cpu_time",    uint64),
     2.5      ("vcpu_max_id", uint32),
     2.6      ("vcpu_online", uint32),
     2.7 -    ])
     2.8 +    ], destructor_fn=None)
     2.9  
    2.10  libxl_poolinfo = Struct("poolinfo", [
    2.11      ("poolid", uint32)
    2.12 -    ])
    2.13 +    ], destructor_fn=None)
    2.14  
    2.15  libxl_vminfo = Struct("vminfo", [
    2.16      ("uuid", libxl_uuid),
    2.17      ("domid", domid),
    2.18 -    ])
    2.19 +    ], destructor_fn=None)
    2.20  
    2.21  libxl_version_info = Struct("version_info", [
    2.22      ("xen_version_major", integer),
    2.23 @@ -132,7 +132,7 @@ libxl_domain_build_state = Struct("domai
    2.24      ("store_mfn",    unsigned_long),
    2.25      ("console_port", uint32),
    2.26      ("console_mfn",  unsigned_long),
    2.27 -    ])
    2.28 +    ], destructor_fn=None)
    2.29  
    2.30  libxl_device_model_info = Struct("device_model_info",[
    2.31      ("domid",            integer),
    2.32 @@ -308,12 +308,12 @@ libxl_physinfo = Struct("physinfo", [
    2.33      ("nr_nodes", uint32),
    2.34      ("hw_cap", libxl_hwcap),
    2.35      ("phys_cap", uint32),
    2.36 -    ])
    2.37 +    ], destructor_fn=None)
    2.38  
    2.39  libxl_sched_credit = Struct("sched_credit", [
    2.40      ("weight", integer),
    2.41      ("cap", integer),
    2.42 -    ])
    2.43 +    ], destructor_fn=None)
    2.44  
    2.45  libxl_net2info = Struct("net2info", [
    2.46      ("backend", string),