White spaces, coding style

(cherry picked from commit c12d33aca6b0fc0a85869b6e9163674bc0e33fe9)
This commit is contained in:
Marcelo Roberto Jimenez 2012-03-07 15:06:26 -03:00
parent 4fd84cbee1
commit 715d4d6174

View File

@ -233,55 +233,42 @@ int ixmlElement_setAttributeNode(
IXML_Node *preSib = NULL; IXML_Node *preSib = NULL;
IXML_Node *nextSib = NULL; IXML_Node *nextSib = NULL;
if (element == NULL || newAttr == NULL) { if (!element || !newAttr)
return IXML_INVALID_PARAMETER; return IXML_INVALID_PARAMETER;
} if (newAttr->n.ownerDocument != element->n.ownerDocument)
if (newAttr->n.ownerDocument != element->n.ownerDocument) {
return IXML_WRONG_DOCUMENT_ERR; return IXML_WRONG_DOCUMENT_ERR;
} if (newAttr->ownerElement)
if (newAttr->ownerElement != NULL) {
return IXML_INUSE_ATTRIBUTE_ERR; return IXML_INUSE_ATTRIBUTE_ERR;
}
newAttr->ownerElement = element; newAttr->ownerElement = element;
node = (IXML_Node *)newAttr; node = (IXML_Node *)newAttr;
attrNode = element->n.firstAttr; attrNode = element->n.firstAttr;
while (attrNode != NULL) { while (attrNode) {
if (strcmp(attrNode->nodeName, node->nodeName) == 0) { if (!strcmp(attrNode->nodeName, node->nodeName))
/* Found it */ /* Found it */
break; break;
} else { else
attrNode = attrNode->nextSibling; attrNode = attrNode->nextSibling;
}
} }
if (attrNode) {
if (attrNode != NULL) {
/* Already present, will replace by newAttr */ /* Already present, will replace by newAttr */
preSib = attrNode->prevSibling; preSib = attrNode->prevSibling;
nextSib = attrNode->nextSibling; nextSib = attrNode->nextSibling;
if (preSib != NULL) { if (preSib)
preSib->nextSibling = node; preSib->nextSibling = node;
} if (nextSib)
if (nextSib != NULL) {
nextSib->prevSibling = node; nextSib->prevSibling = node;
} if (element->n.firstAttr == attrNode)
if (element->n.firstAttr == attrNode) {
element->n.firstAttr = node; element->n.firstAttr = node;
} if (rtAttr)
if (rtAttr != NULL) {
*rtAttr = (IXML_Attr *)attrNode; *rtAttr = (IXML_Attr *)attrNode;
} else { else
ixmlAttr_free((IXML_Attr *)attrNode); ixmlAttr_free((IXML_Attr *)attrNode);
}
} else { } else {
/* Add this attribute */ /* Add this attribute */
if (element->n.firstAttr != NULL) { if (element->n.firstAttr) {
prevAttr = element->n.firstAttr; prevAttr = element->n.firstAttr;
nextAttr = prevAttr->nextSibling; nextAttr = prevAttr->nextSibling;
while (nextAttr != NULL) { while (nextAttr) {
prevAttr = nextAttr; prevAttr = nextAttr;
nextAttr = prevAttr->nextSibling; nextAttr = prevAttr->nextSibling;
} }
@ -293,10 +280,8 @@ int ixmlElement_setAttributeNode(
node->prevSibling = NULL; node->prevSibling = NULL;
node->nextSibling = NULL; node->nextSibling = NULL;
} }
if (rtAttr)
if (rtAttr != NULL) {
*rtAttr = NULL; *rtAttr = NULL;
}
} }
return IXML_SUCCESS; return IXML_SUCCESS;