Skip to content
Snippets Groups Projects
Commit d14b466b authored by Jakob Olsson's avatar Jakob Olsson
Browse files

some style fixes

parent f4c34cd7
Branches
Tags
No related merge requests found
......@@ -69,19 +69,18 @@ char *xml_parser(struct write_result *result, char *tag)
xpathctx_ptr = doc_ptr ? xmlXPathNewContext(doc_ptr) : NULL;
xpathobj_ptr = xpathctx_ptr ? xmlXPathEvalExpression((xmlChar *)tag, xpathctx_ptr) : NULL;
if (xpathobj_ptr)
{
if (xpathobj_ptr) {
int n;
xmlNodeSetPtr nodeset_ptr = xpathobj_ptr->nodesetval;
for (n = 0; nodeset_ptr && n < xmlXPathNodeSetGetLength(nodeset_ptr); n++)
{
for (n = 0; nodeset_ptr && n < xmlXPathNodeSetGetLength(nodeset_ptr); n++) {
//if (DEBUG)
//debug_print("n value: %d\n", n);
xmlNodePtr node_ptr = nodeset_ptr->nodeTab[n];
if (node_ptr->type != XML_ATTRIBUTE_NODE && node_ptr->type != XML_ELEMENT_NODE && node_ptr->type != XML_CDATA_SECTION_NODE)
continue;
if (node_ptr->children)
{
if (node_ptr->children) {
//tag_content = (char*) node_ptr->children->content;
strcpy(tag_content, (char *)node_ptr->children->content);
debug_print("tag content: %s\n", tag_content);
......@@ -108,16 +107,13 @@ void xml_to_json(xmlNode *anode, json_object *jobj)
xmlNodePtr cur_node = NULL;
json_object *cur_jstr = NULL;
for (cur_node = anode; cur_node; cur_node = cur_node->next)
{
for (cur_node = anode; cur_node; cur_node = cur_node->next) {
debug_print("child address: %p\n", cur_node);
debug_print("next addres: %p\n", cur_node->next);
debug_print("root child content: %s\n", (uint8_t *)xmlNodeGetContent(cur_node));
if (cur_node->type == XML_ELEMENT_NODE)
{
if (xmlChildElementCount(cur_node) == 0)
{
if (cur_node->type == XML_ELEMENT_NODE) {
if (xmlChildElementCount(cur_node) == 0) {
cur_jstr = json_object_new_string((char *)xmlNodeGetContent(cur_node));
debug_print("xmlNodeGet name: %sn", (char *)cur_node->name);
......
......@@ -41,14 +41,11 @@ int parse_args(int argc, char **argv)
{
char ch;
while ((ch = getopt_long(argc, argv, "d:", long_options, NULL)) != -1)
{
switch (ch)
{
while ((ch = getopt_long(argc, argv, "d:", long_options, NULL)) != -1) {
switch (ch) {
case 'd':
debug = atoi(optarg);
if (debug > 1 || debug < 0)
{
if (debug > 1 || debug < 0) {
printf("%s: option '-%c' is invalid.\n", argv[0], optopt); //cant exactly do debug print in here...
goto fail;
}
......@@ -103,6 +100,7 @@ int tag_missing_devices(void)
int add_device(struct device *new_dev)
{
struct device *dev;
dev = search_list(new_dev->usb.if_name);
if (dev) {
if (dev->ip)
......@@ -502,8 +500,7 @@ int list_to_blob(struct blob_buf *bb)
if (rv < 0)
goto fail_string;
if (net_dev->ip)
{
if (net_dev->ip) {
rv = blobmsg_add_string(bb, "ip", net_dev->ip);
if (rv < 0)
goto fail_string;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment