Commit 44a80b12 authored by Bjorn Andersson's avatar Bjorn Andersson
Browse files

qdl: Remove possibility for uninitialized variable



In the case that we find a "data" tag, but not a "program" or "ufs"
child node type might have been left unitialized. Fix this by
initializing type.

Also fix up the styling of the multiline blocks.
Signed-off-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
parent d2e791a9
......@@ -67,7 +67,7 @@ static int detect_type(const char *xml_file)
xmlNode *root;
xmlDoc *doc;
xmlNode *node;
int type;
int type = QDL_FILE_UNKNOWN;
doc = xmlReadFile(xml_file, NULL, 0);
if (!doc) {
......@@ -76,9 +76,9 @@ static int detect_type(const char *xml_file)
}
root = xmlDocGetRootElement(doc);
if (!xmlStrcmp(root->name, (xmlChar*)"patches"))
if (!xmlStrcmp(root->name, (xmlChar*)"patches")) {
type = QDL_FILE_PATCH;
else if (!xmlStrcmp(root->name, (xmlChar*)"data")) {
} else if (!xmlStrcmp(root->name, (xmlChar*)"data")) {
for (node = root->children; node ; node = node->next) {
if (node->type != XML_ELEMENT_NODE)
continue;
......@@ -91,11 +91,9 @@ static int detect_type(const char *xml_file)
break;
}
}
}
else if (!xmlStrcmp(root->name, (xmlChar*)"contents"))
} else if (!xmlStrcmp(root->name, (xmlChar*)"contents")) {
type = QDL_FILE_CONTENTS;
else
type = QDL_FILE_UNKNOWN;
}
xmlFreeDoc(doc);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment