projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
tests: Correct text when enabling a small overwrite kernel channel
[lttng-tools.git]
/
tests
/
utils
/
xml-utils
/
pretty_xml.cpp
diff --git
a/tests/utils/xml-utils/pretty_xml.cpp
b/tests/utils/xml-utils/pretty_xml.cpp
index 3f296f0235342ca17b5c2e032984899b7071f93b..8a6e967a71da8c73c687fcf6c3cec23d88ce4fad 100644
(file)
--- a/
tests/utils/xml-utils/pretty_xml.cpp
+++ b/
tests/utils/xml-utils/pretty_xml.cpp
@@
-10,28
+10,30
@@
* This allows a more human friendly format for xml testing when problems occur.
*/
* This allows a more human friendly format for xml testing when problems occur.
*/
+#include "common.hpp"
+
+#include <common/scope-exit.hpp>
+
+#include <iostream>
#include <libxml/parser.h>
#include <libxml/parser.h>
+#include <unistd.h>
-int main(void)
-{
- xmlDocPtr doc = NULL;
+namespace ll = lttng::libxml;
- /* Init libxml. */
- xmlInitParser();
- xmlKeepBlanksDefault(0);
+int main()
+{
+ const ll::global_parser_context global_parser_context;
+ const ll::parser_ctx_uptr parserCtx{ xmlNewParserCtxt() };
/* Parse the XML document from stdin. */
/* Parse the XML document from stdin. */
- doc = xmlParseFile("-");
+ const ll::doc_uptr doc{ xmlCtxtReadFd(
+ parserCtx.get(), STDIN_FILENO, nullptr, nullptr, XML_PARSE_NOBLANKS) };
if (!doc) {
if (!doc) {
-
fprintf(stderr, "ERR parsing: xml input invalid")
;
+
std::cerr << "Error: invalid XML input on stdin\n"
;
return -1;
}
return -1;
}
- xmlDocFormatDump(stdout, doc, 1);
-
- xmlFreeDoc(doc);
- /* Shutdown libxml. */
- xmlCleanupParser();
+ xmlDocFormatDump(stdout, doc.get(), 1);
return 0;
}
return 0;
}
This page took
0.030802 seconds
and
4
git commands to generate.