mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-03-23 02:50:08 +03:00
tree: Fix regression when copying DTDs
This reverts commit d39f78069dff496ec865c73aa44d7110e429bce9. Fixes #634.
This commit is contained in:
parent
ec7f65069a
commit
de3f70146d
31
tree.c
31
tree.c
@ -4301,28 +4301,29 @@ xmlNodePtr
|
||||
xmlStaticCopyNodeList(xmlNodePtr node, xmlDocPtr doc, xmlNodePtr parent) {
|
||||
xmlNodePtr ret = NULL;
|
||||
xmlNodePtr p = NULL,q;
|
||||
xmlDtdPtr newSubset = NULL;
|
||||
|
||||
while (node != NULL) {
|
||||
if (node->type == XML_DTD_NODE ) {
|
||||
#ifdef LIBXML_TREE_ENABLED
|
||||
if ((doc == NULL) || (doc->intSubset != NULL)) {
|
||||
if (node->type == XML_DTD_NODE ) {
|
||||
if (doc == NULL) {
|
||||
node = node->next;
|
||||
continue;
|
||||
}
|
||||
q = (xmlNodePtr) xmlCopyDtd( (xmlDtdPtr) node );
|
||||
if (q == NULL) goto error;
|
||||
q->doc = doc;
|
||||
q->parent = parent;
|
||||
newSubset = (xmlDtdPtr) q;
|
||||
#else
|
||||
node = node->next;
|
||||
continue;
|
||||
if (doc->intSubset == NULL) {
|
||||
q = (xmlNodePtr) xmlCopyDtd( (xmlDtdPtr) node );
|
||||
if (q == NULL) goto error;
|
||||
q->doc = doc;
|
||||
q->parent = parent;
|
||||
doc->intSubset = (xmlDtdPtr) q;
|
||||
xmlAddChild(parent, q);
|
||||
} else {
|
||||
q = (xmlNodePtr) doc->intSubset;
|
||||
xmlAddChild(parent, q);
|
||||
}
|
||||
} else
|
||||
#endif /* LIBXML_TREE_ENABLED */
|
||||
} else {
|
||||
q = xmlStaticCopyNode(node, doc, parent, 1);
|
||||
if (q == NULL) goto error;
|
||||
}
|
||||
if (q == NULL) goto error;
|
||||
if (ret == NULL) {
|
||||
q->prev = NULL;
|
||||
ret = p = q;
|
||||
@ -4334,8 +4335,6 @@ xmlStaticCopyNodeList(xmlNodePtr node, xmlDocPtr doc, xmlNodePtr parent) {
|
||||
}
|
||||
node = node->next;
|
||||
}
|
||||
if (newSubset != NULL)
|
||||
doc->intSubset = newSubset;
|
||||
return(ret);
|
||||
error:
|
||||
xmlFreeNodeList(ret);
|
||||
|
Loading…
x
Reference in New Issue
Block a user