That wrapper is going to be used to safely log a json_object, as
libxl__json_object_to_json return NULL on error. In the error case,
JSON() will return an invalid json string.
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
_hidden char *libxl__json_object_to_json(libxl__gc *gc,
const libxl__json_object *args);
+/* Always return a valid string, but invalid json on error. */
+#define JSON(o) \
+ (libxl__json_object_to_json(gc, (o)) ? : "<invalid-json-object>")
/* Based on /local/domain/$domid/dm-version xenstore key
* default is qemu xen traditional */