projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
clang-tidy: add Chrome-inspired checks
[lttng-tools.git]
/
tests
/
utils
/
xml-utils
/
extract_xml.cpp
diff --git
a/tests/utils/xml-utils/extract_xml.cpp
b/tests/utils/xml-utils/extract_xml.cpp
index bc5fc3e51990bd5b46cce987e71b686619f9875e..3995dde48a27d9d96485f148222b883f58f4ef10 100644
(file)
--- a/
tests/utils/xml-utils/extract_xml.cpp
+++ b/
tests/utils/xml-utils/extract_xml.cpp
@@
-24,18
+24,18
@@
* node;b;
* node;c;
*/
* node;b;
* node;c;
*/
+#include <common/defaults.hpp>
+
+#include <libxml/parser.h>
+#include <libxml/tree.h>
+#include <libxml/xpath.h>
+#include <libxml/xpathInternals.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-#include <libxml/tree.h>
-#include <libxml/parser.h>
-#include <libxml/xpath.h>
-#include <libxml/xpathInternals.h>
-#include <common/defaults.h>
-
#if defined(LIBXML_XPATH_ENABLED)
static int opt_verbose;
#if defined(LIBXML_XPATH_ENABLED)
static int opt_verbose;
@@
-56,7
+56,7
@@
static int print_xpath_nodes(xmlDocPtr doc, xmlNodeSetPtr nodes, FILE *output)
int i;
xmlNodePtr cur;
int i;
xmlNodePtr cur;
- xmlChar *node_child_value_string =
NULL
;
+ xmlChar *node_child_value_string =
nullptr
;
LTTNG_ASSERT(output);
size = (nodes) ? nodes->nodeNr : 0;
LTTNG_ASSERT(output);
size = (nodes) ? nodes->nodeNr : 0;
@@
-65,8
+65,9
@@
static int print_xpath_nodes(xmlDocPtr doc, xmlNodeSetPtr nodes, FILE *output)
LTTNG_ASSERT(nodes->nodeTab[i]);
if (nodes->nodeTab[i]->type == XML_NAMESPACE_DECL) {
LTTNG_ASSERT(nodes->nodeTab[i]);
if (nodes->nodeTab[i]->type == XML_NAMESPACE_DECL) {
- fprintf(stderr, "ERR:%s\n",
- "This executable does not support xml namespacing\n");
+ fprintf(stderr,
+ "ERR:%s\n",
+ "This executable does not support xml namespacing\n");
ret = -1;
goto end;
} else if (nodes->nodeTab[i]->type == XML_ELEMENT_NODE) {
ret = -1;
goto end;
} else if (nodes->nodeTab[i]->type == XML_ELEMENT_NODE) {
@@
-74,16
+75,17
@@
static int print_xpath_nodes(xmlDocPtr doc, xmlNodeSetPtr nodes, FILE *output)
if (xmlChildElementCount(cur) == 0) {
if (xmlNodeIsText(cur->children)) {
if (xmlChildElementCount(cur) == 0) {
if (xmlNodeIsText(cur->children)) {
- node_child_value_string =
xmlNodeListGetString(doc,
-
cur->children, 1);
+ node_child_value_string =
+
xmlNodeListGetString(doc,
cur->children, 1);
if (node_exist) {
result = true;
} else if (opt_verbose) {
if (node_exist) {
result = true;
} else if (opt_verbose) {
- fprintf(output, "%s;%s;\n", cur->name,
- node_child_value_string);
+ fprintf(output,
+ "%s;%s;\n",
+ cur->name,
+ node_child_value_string);
} else {
} else {
- fprintf(output, "%s\n",
- node_child_value_string);
+ fprintf(output, "%s\n", node_child_value_string);
}
xmlFree(node_child_value_string);
} else {
}
xmlFree(node_child_value_string);
} else {
@@
-91,8
+93,9
@@
static int print_xpath_nodes(xmlDocPtr doc, xmlNodeSetPtr nodes, FILE *output)
if (node_exist) {
result = true;
} else {
if (node_exist) {
result = true;
} else {
- fprintf(stderr, "ERR:%s\n",
- "Xpath expression return non-final xml element");
+ fprintf(stderr,
+ "ERR:%s\n",
+ "Xpath expression return non-final xml element");
ret = -1;
goto end;
}
ret = -1;
goto end;
}
@@
-102,8
+105,9
@@
static int print_xpath_nodes(xmlDocPtr doc, xmlNodeSetPtr nodes, FILE *output)
result = true;
} else {
/* We don't want to print non-final element */
result = true;
} else {
/* We don't want to print non-final element */
- fprintf(stderr, "ERR:%s\n",
- "Xpath expression return non-final xml element");
+ fprintf(stderr,
+ "ERR:%s\n",
+ "Xpath expression return non-final xml element");
ret = -1;
goto end;
}
ret = -1;
goto end;
}
@@
-131,7
+135,7
@@
static int register_lttng_namespace(xmlXPathContextPtr xpathCtx)
{
int ret;
xmlChar *prefix;
{
int ret;
xmlChar *prefix;
- xmlChar *ns =
NULL
;
+ xmlChar *ns =
nullptr
;
prefix = xmlCharStrdup("lttng");
if (!prefix) {
prefix = xmlCharStrdup("lttng");
if (!prefix) {
@@
-165,9
+169,9
@@
end:
static int extract_xpath(const char *xml_path, const xmlChar *xpath)
{
int ret;
static int extract_xpath(const char *xml_path, const xmlChar *xpath)
{
int ret;
- xmlDocPtr doc =
NULL
;
- xmlXPathContextPtr xpathCtx =
NULL
;
- xmlXPathObjectPtr xpathObj =
NULL
;
+ xmlDocPtr doc =
nullptr
;
+ xmlXPathContextPtr xpathCtx =
nullptr
;
+ xmlXPathObjectPtr xpathObj =
nullptr
;
LTTNG_ASSERT(xml_path);
LTTNG_ASSERT(xpath);
LTTNG_ASSERT(xml_path);
LTTNG_ASSERT(xpath);
@@
-255,7
+259,7
@@
int main(int argc, char **argv)
return -1;
}
/* Do the main job */
return -1;
}
/* Do the main job */
- if (extract_xpath(argv[optind], (xmlChar *)
argv[optind+
1])) {
+ if (extract_xpath(argv[optind], (xmlChar *)
argv[optind +
1])) {
return -1;
}
return -1;
}
This page took
0.026055 seconds
and
4
git commands to generate.