summaryrefslogtreecommitdiff
path: root/relaxng.c
diff options
context:
space:
mode:
Diffstat (limited to 'relaxng.c')
-rw-r--r--relaxng.c42
1 files changed, 11 insertions, 31 deletions
diff --git a/relaxng.c b/relaxng.c
index 8d88e95..370e314 100644
--- a/relaxng.c
+++ b/relaxng.c
@@ -1095,7 +1095,7 @@ xmlRelaxNGAddStates(xmlRelaxNGValidCtxtPtr ctxt,
{
int i;
- if (state == NULL || states == NULL) {
+ if (state == NULL) {
return (-1);
}
if (states->nbState >= states->maxState) {
@@ -2595,10 +2595,13 @@ xmlRelaxNGSchemaTypeCompare(void *data ATTRIBUTE_UNUSED,
}
ret = xmlSchemaValPredefTypeNode(typ, value2, &res2, ctxt2);
if (ret != 0) {
- if (res1 != (xmlSchemaValPtr) comp1)
+ if ((comp1 == NULL) && (res1 != NULL))
xmlSchemaFreeValue(res1);
return (-1);
}
+ if (res1 == NULL) {
+ return (-1);
+ }
ret = xmlSchemaCompareValues(res1, res2);
if (res1 != (xmlSchemaValPtr) comp1)
xmlSchemaFreeValue(res1);
@@ -6600,7 +6603,7 @@ xmlRelaxNGParseGrammar(xmlRelaxNGParserCtxtPtr ctxt, xmlNodePtr nodes)
}
/*
- * Apply 4.17 merging rules to defines and starts
+ * Apply 4.17 mergingd rules to defines and starts
*/
xmlRelaxNGCombineStart(ctxt, ret);
if (ret->defs != NULL) {
@@ -6652,17 +6655,12 @@ xmlRelaxNGParseDocument(xmlRelaxNGParserCtxtPtr ctxt, xmlNodePtr node)
ctxt->define = NULL;
if (IS_RELAXNG(node, "grammar")) {
schema->topgrammar = xmlRelaxNGParseGrammar(ctxt, node->children);
- if (schema->topgrammar == NULL) {
- xmlRelaxNGFree(schema);
- return (NULL);
- }
} else {
xmlRelaxNGGrammarPtr tmp, ret;
schema->topgrammar = ret = xmlRelaxNGNewGrammar(ctxt);
if (schema->topgrammar == NULL) {
- xmlRelaxNGFree(schema);
- return (NULL);
+ return (schema);
}
/*
* Link the new grammar in the tree
@@ -7319,7 +7317,7 @@ xmlRelaxNGCleanupTree(xmlRelaxNGParserCtxtPtr ctxt, xmlNodePtr root)
}
}
/*
- * This is not an else since "include" is transformed
+ * Thisd is not an else since "include" is transformed
* into a div
*/
if (xmlStrEqual(cur->name, BAD_CAST "div")) {
@@ -7348,13 +7346,13 @@ xmlRelaxNGCleanupTree(xmlRelaxNGParserCtxtPtr ctxt, xmlNodePtr root)
if (ns != NULL)
xmlFree(ns);
/*
- * Since we are about to delete cur, if its nsDef is non-NULL we
+ * Since we are about to delete cur, if it's nsDef is non-NULL we
* need to preserve it (it contains the ns definitions for the
* children we just moved). We'll just stick it on to the end
* of cur->parent's list, since it's never going to be re-serialized
* (bug 143738).
*/
- if ((cur->nsDef != NULL) && (cur->parent != NULL)) {
+ if (cur->nsDef != NULL) {
xmlNsPtr parDef = (xmlNsPtr)&cur->parent->nsDef;
while (parDef->next != NULL)
parDef = parDef->next;
@@ -7372,8 +7370,7 @@ xmlRelaxNGCleanupTree(xmlRelaxNGParserCtxtPtr ctxt, xmlNodePtr root)
else if ((cur->type == XML_TEXT_NODE) ||
(cur->type == XML_CDATA_SECTION_NODE)) {
if (IS_BLANK_NODE(cur)) {
- if ((cur->parent != NULL) &&
- (cur->parent->type == XML_ELEMENT_NODE)) {
+ if (cur->parent->type == XML_ELEMENT_NODE) {
if ((!xmlStrEqual(cur->parent->name, BAD_CAST "value"))
&&
(!xmlStrEqual
@@ -9053,19 +9050,6 @@ xmlRelaxNGAttributeMatch(xmlRelaxNGValidCtxtPtr ctxt,
return (ret);
list = list->next;
}
- } else if (define->type == XML_RELAXNG_CHOICE) {
- xmlRelaxNGDefinePtr list;
-
- list = define->nameClass;
- while (list != NULL) {
- ret = xmlRelaxNGAttributeMatch(ctxt, list, prop);
- if (ret == 1)
- return (1);
- if (ret < 0)
- return (ret);
- list = list->next;
- }
- return (0);
} else {
TODO}
return (1);
@@ -9425,10 +9409,6 @@ xmlRelaxNGValidateInterleave(xmlRelaxNGValidCtxtPtr ctxt,
oldstate = ctxt->state;
for (i = 0; i < nbgroups; i++) {
ctxt->state = xmlRelaxNGCopyValidState(ctxt, oldstate);
- if (ctxt->state == NULL) {
- ret = -1;
- break;
- }
group = partitions->groups[i];
if (lasts[i] != NULL) {
last = lasts[i]->next;