tests: convert pretty_xml.c to C++
authorSimon Marchi <simon.marchi@efficios.com>
Tue, 30 Apr 2024 19:22:15 +0000 (15:22 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 1 May 2024 14:58:46 +0000 (10:58 -0400)
Change-Id: I40e0aa849193e789bf6634068a92b55484ab17af
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
tests/utils/xml-utils/Makefile.am
tests/utils/xml-utils/pretty_xml.c [deleted file]
tests/utils/xml-utils/pretty_xml.cpp [new file with mode: 0644]

index 7997d94e126369e694114d5b7584d593ba637c8b..eec519d3128d5e5799f8f12e7532d5a4db02ef42 100644 (file)
@@ -9,7 +9,7 @@ extract_xml_SOURCES = extract_xml.cpp
 extract_xml_CPPFLAGS = $(libxml2_CFLAGS) $(AM_CPPFLAGS)
 extract_xml_LDADD = $(libxml2_LIBS)
 
-pretty_xml_SOURCES = pretty_xml.c
+pretty_xml_SOURCES = pretty_xml.cpp
 pretty_xml_CPPFLAGS = $(libxml2_CFLAGS) $(AM_CPPFLAGS)
 pretty_xml_LDADD = $(libxml2_LIBS)
 
diff --git a/tests/utils/xml-utils/pretty_xml.c b/tests/utils/xml-utils/pretty_xml.c
deleted file mode 100644 (file)
index 3f296f0..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2021 EfficiOS Inc.
- *
- * SPDX-License-Identifier: GPL-2.0-only
- *
- */
-
-/*
- * Prettyfi a xml input from stdin to stddout.
- * This allows a more human friendly format for xml testing when problems occur.
- */
-
-#include <libxml/parser.h>
-
-int main(void)
-{
-       xmlDocPtr doc = NULL;
-
-       /* Init libxml. */
-       xmlInitParser();
-       xmlKeepBlanksDefault(0);
-
-       /* Parse the XML document from stdin. */
-       doc = xmlParseFile("-");
-       if (!doc) {
-               fprintf(stderr, "ERR parsing: xml input invalid");
-               return -1;
-       }
-
-       xmlDocFormatDump(stdout, doc, 1);
-
-       xmlFreeDoc(doc);
-       /* Shutdown libxml. */
-       xmlCleanupParser();
-
-       return 0;
-}
diff --git a/tests/utils/xml-utils/pretty_xml.cpp b/tests/utils/xml-utils/pretty_xml.cpp
new file mode 100644 (file)
index 0000000..3f296f0
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2021 EfficiOS Inc.
+ *
+ * SPDX-License-Identifier: GPL-2.0-only
+ *
+ */
+
+/*
+ * Prettyfi a xml input from stdin to stddout.
+ * This allows a more human friendly format for xml testing when problems occur.
+ */
+
+#include <libxml/parser.h>
+
+int main(void)
+{
+       xmlDocPtr doc = NULL;
+
+       /* Init libxml. */
+       xmlInitParser();
+       xmlKeepBlanksDefault(0);
+
+       /* Parse the XML document from stdin. */
+       doc = xmlParseFile("-");
+       if (!doc) {
+               fprintf(stderr, "ERR parsing: xml input invalid");
+               return -1;
+       }
+
+       xmlDocFormatDump(stdout, doc, 1);
+
+       xmlFreeDoc(doc);
+       /* Shutdown libxml. */
+       xmlCleanupParser();
+
+       return 0;
+}
This page took 0.026939 seconds and 4 git commands to generate.