mirror of
https://github.com/GNOME/libxml2.git
synced 2025-10-20 05:14:10 +08:00
Remove dead code in xinclude.c
'doc' is checked for NULL in xmlXIncludeLoadDoc, so several code paths can be eliminated.
This commit is contained in:
43
xinclude.c
43
xinclude.c
@@ -59,7 +59,6 @@ struct _xmlXIncludeRef {
|
||||
xmlNodePtr inc; /* the included copy */
|
||||
int xml; /* xml or txt */
|
||||
int count; /* how many refs use that specific doc */
|
||||
xmlXPathObjectPtr xptr; /* the xpointer if needed */
|
||||
int skip; /* skip in case of errors */
|
||||
int fallback; /* fallback was loaded */
|
||||
};
|
||||
@@ -211,8 +210,6 @@ xmlXIncludeFreeRef(xmlXIncludeRefPtr ref) {
|
||||
xmlFree(ref->URI);
|
||||
if (ref->fragment != NULL)
|
||||
xmlFree(ref->fragment);
|
||||
if (ref->xptr != NULL)
|
||||
xmlXPathFreeObject(ref->xptr);
|
||||
xmlFree(ref);
|
||||
}
|
||||
|
||||
@@ -1557,15 +1554,8 @@ loaded:
|
||||
/*
|
||||
* Add the top children list as the replacement copy.
|
||||
*/
|
||||
if (doc == NULL)
|
||||
{
|
||||
/* Hopefully a DTD declaration won't be copied from
|
||||
* the same document */
|
||||
ctxt->incTab[nr]->inc = xmlCopyNodeList(ctxt->doc->children);
|
||||
} else {
|
||||
ctxt->incTab[nr]->inc = xmlXIncludeCopyNodeList(ctxt, ctxt->doc,
|
||||
doc, doc->children);
|
||||
}
|
||||
ctxt->incTab[nr]->inc = xmlXIncludeCopyNodeList(ctxt, ctxt->doc,
|
||||
doc, doc->children);
|
||||
}
|
||||
#ifdef LIBXML_XPTR_ENABLED
|
||||
else {
|
||||
@@ -1577,12 +1567,7 @@ loaded:
|
||||
xmlXPathContextPtr xptrctxt;
|
||||
xmlNodeSetPtr set;
|
||||
|
||||
if (doc == NULL) {
|
||||
xptrctxt = xmlXPtrNewContext(ctxt->doc, ctxt->incTab[nr]->ref,
|
||||
NULL);
|
||||
} else {
|
||||
xptrctxt = xmlXPtrNewContext(doc, NULL, NULL);
|
||||
}
|
||||
xptrctxt = xmlXPtrNewContext(doc, NULL, NULL);
|
||||
if (xptrctxt == NULL) {
|
||||
xmlXIncludeErr(ctxt, ctxt->incTab[nr]->ref,
|
||||
XML_XINCLUDE_XPTR_FAILED,
|
||||
@@ -1686,14 +1671,9 @@ loaded:
|
||||
}
|
||||
}
|
||||
}
|
||||
if (doc == NULL) {
|
||||
ctxt->incTab[nr]->xptr = xptr;
|
||||
ctxt->incTab[nr]->inc = NULL;
|
||||
} else {
|
||||
ctxt->incTab[nr]->inc =
|
||||
xmlXIncludeCopyXPointer(ctxt, ctxt->doc, doc, xptr);
|
||||
xmlXPathFreeObject(xptr);
|
||||
}
|
||||
ctxt->incTab[nr]->inc =
|
||||
xmlXIncludeCopyXPointer(ctxt, ctxt->doc, doc, xptr);
|
||||
xmlXPathFreeObject(xptr);
|
||||
xmlXPathFreeContext(xptrctxt);
|
||||
xmlFree(fragment);
|
||||
}
|
||||
@@ -2212,17 +2192,6 @@ xmlXIncludeIncludeNode(xmlXIncludeCtxtPtr ctxt, int nr) {
|
||||
if ((cur == NULL) || (cur->type == XML_NAMESPACE_DECL))
|
||||
return(-1);
|
||||
|
||||
/*
|
||||
* If we stored an XPointer a late computation may be needed
|
||||
*/
|
||||
if ((ctxt->incTab[nr]->inc == NULL) &&
|
||||
(ctxt->incTab[nr]->xptr != NULL)) {
|
||||
ctxt->incTab[nr]->inc =
|
||||
xmlXIncludeCopyXPointer(ctxt, ctxt->doc, ctxt->doc,
|
||||
ctxt->incTab[nr]->xptr);
|
||||
xmlXPathFreeObject(ctxt->incTab[nr]->xptr);
|
||||
ctxt->incTab[nr]->xptr = NULL;
|
||||
}
|
||||
list = ctxt->incTab[nr]->inc;
|
||||
ctxt->incTab[nr]->inc = NULL;
|
||||
|
||||
|
Reference in New Issue
Block a user