1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-10-21 14:53:44 +03:00

tree: Allocate XML namespace statically

This commit is contained in:
Nick Wellnhofer
2024-03-04 07:34:25 +01:00
parent 696faeb474
commit 2840e33c5e
7 changed files with 86 additions and 215 deletions

View File

@@ -101,6 +101,10 @@ xmlNsCheckScope(xmlNodePtr node, xmlNsPtr ns)
(node->type != XML_XINCLUDE_START))
return(-2);
/* xml namespace */
if (xmlStrEqual(ns->prefix, BAD_CAST "xml"))
return(1);
while ((node != NULL) &&
((node->type == XML_ELEMENT_NODE) ||
(node->type == XML_ATTRIBUTE_NODE) ||
@@ -119,14 +123,7 @@ xmlNsCheckScope(xmlNodePtr node, xmlNsPtr ns)
}
node = node->parent;
}
/* the xml namespace may be declared on the document node */
if ((node != NULL) &&
((node->type == XML_DOCUMENT_NODE) ||
(node->type == XML_HTML_DOCUMENT_NODE))) {
xmlNsPtr oldNs = ((xmlDocPtr) node)->oldNs;
if (oldNs == ns)
return(1);
}
return(-3);
}