Open MPI logo

Hardware Locality Development Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Hardware Locality Development mailing list

Subject: [hwloc-devel] xmlbuffer and xmlFree()
From: Brice Goglin (Brice.Goglin_at_[hidden])
Date: 2011-09-05 03:15:42


(side note from the current discussion about XML/JSON/...)

The doc of hwloc_topology_export_xmlbuffer() says that the returned
buffer should be freed with xmlFree(). xmlFree() is in libxml2, but
hwloc can be built without libxml2 support. So the application can
always use hwloc_topology_export_xmlbuffer() but it cannot safely use
xmlFree() without checking again if libxml2 is available. We need to
something about this:

1) add HWLOC_HAVE_XML to hwloc/autogen/config.h and tell the application
to look at it
2) add hwloc_free_xmlbuffer()
3a) change hwloc_topology_export_xmlbuffer() to return a normal buffer
copied from the xml-allocated one
3b) change hwloc_topology_export_xmlbuffer() to have the application
provide the destination buffer (would require one export to get the
actual length, malloc, and an another export with the right length).

(1) isn't very nice, and doesn't abstract us away from libxml2
(2) is easy
(3) breaks the ABI

Brice