}
file_opened = 1;
- writer = config_writer_create(fd);
+ writer = config_writer_create(fd, 1);
if (!writer) {
ret = LTTNG_ERR_NOMEM;
goto end;
}
LTTNG_HIDDEN
-struct config_writer *config_writer_create(int fd_output)
+struct config_writer *config_writer_create(int fd_output, int indent)
{
int ret;
struct config_writer *writer;
ret = xmlTextWriterSetIndentString(writer->writer,
BAD_CAST config_xml_indent_string);
- if (ret) {
+ if (ret) {
goto error_destroy;
}
- ret = xmlTextWriterSetIndent(writer->writer, 1);
- if (ret) {
+ ret = xmlTextWriterSetIndent(writer->writer, indent);
+ if (ret) {
goto error_destroy;
}
* fd_output File to which the XML content must be written. The file will be
* closed once the config_writer has been destroyed.
*
+ * indent If other than 0 the XML will be pretty printed
+ * with indentation and newline.
+ *
* Returns an instance of a configuration writer on success, NULL on
* error.
*/
LTTNG_HIDDEN
-struct config_writer *config_writer_create(int fd_output);
+struct config_writer *config_writer_create(int fd_output, int indent);
/*
* Destroy an instance of a configuration writer.
goto end;
}
if (mi_output_type == LTTNG_MI_XML) {
- mi_writer->writer = config_writer_create(fd_output);
+ mi_writer->writer = config_writer_create(fd_output, 0);
if (!mi_writer->writer) {
goto err_destroy;
}