Simplify code in SampleUtil_GetFirstDocumentItem().

(cherry picked from commit 70d2a7c9e7bf3cfd073c519211ea4379ac2ae8f1)
This commit is contained in:
Marcelo Roberto Jimenez 2010-12-23 18:40:53 -02:00
parent 3bf350cceb
commit d4ef92e1bd

View File

@ -208,24 +208,18 @@ char *SampleUtil_GetFirstDocumentItem(IXML_Document *doc, const char *item)
ret = strdup(""); ret = strdup("");
goto epilogue; goto epilogue;
} }
if (!ixmlNode_getNodeValue(textNode)) { ret = ixmlNode_getNodeValue(textNode);
if (!ret) {
SampleUtil_Print("%s(%d): ixmlNode_getNodeValue returned NULL\n", SampleUtil_Print("%s(%d): ixmlNode_getNodeValue returned NULL\n",
__FILE__, __LINE__); __FILE__, __LINE__);
ret = strdup(""); ret = strdup("");
goto epilogue;
} else {
ret = strdup(ixmlNode_getNodeValue(textNode));
} }
} else { } else
SampleUtil_Print("%s(%d): ixmlNode_getFirstChild(tmpNode) returned NULL\n", SampleUtil_Print("%s(%d): ixmlNode_getFirstChild(tmpNode) returned NULL\n",
__FILE__, __LINE__); __FILE__, __LINE__);
goto epilogue; } else
}
} else {
SampleUtil_Print("%s(%d): Error finding %s in XML Node\n", SampleUtil_Print("%s(%d): Error finding %s in XML Node\n",
__FILE__, __LINE__, item); __FILE__, __LINE__, item);
goto epilogue;
}
epilogue: epilogue:
if (nodeList) if (nodeList)