summaryrefslogtreecommitdiff
path: root/xinclude.c
diff options
context:
space:
mode:
authorNick Wellnhofer <wellnhofer@aevum.de>2022-05-20 23:28:25 +0200
committerNick Wellnhofer <wellnhofer@aevum.de>2022-06-20 01:49:39 +0200
commit3e7b4f37aaaf920e6b81e20a3cd33c20420bfa15 (patch)
treeed6c8913b483884ef8173c000d4afffeb6102249 /xinclude.c
parent823bf161566da76a27a079d9febe78c4f996004a (diff)
downloadlibxml2-3e7b4f37aaaf920e6b81e20a3cd33c20420bfa15.tar.gz
Avoid calling xmlSetTreeDoc
Create text nodes with xmlNewDocText or set the document directly to avoid xmlSetTreeDoc being called when the node is inserted.
Diffstat (limited to 'xinclude.c')
-rw-r--r--xinclude.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/xinclude.c b/xinclude.c
index a3aff3e6..0c6b3f29 100644
--- a/xinclude.c
+++ b/xinclude.c
@@ -1849,7 +1849,7 @@ xmlXIncludeLoadTxt(xmlXIncludeCtxtPtr ctxt, const xmlChar *url, int nr) {
*/
for (i = 0; i < ctxt->txtNr; i++) {
if (xmlStrEqual(URL, ctxt->txturlTab[i])) {
- node = xmlNewText(ctxt->txtTab[i]);
+ node = xmlNewDocText(ctxt->doc, ctxt->txtTab[i]);
goto loaded;
}
}
@@ -1898,7 +1898,7 @@ xmlXIncludeLoadTxt(xmlXIncludeCtxtPtr ctxt, const xmlChar *url, int nr) {
if (buf->encoder)
xmlCharEncCloseFunc(buf->encoder);
buf->encoder = xmlGetCharEncodingHandler(enc);
- node = xmlNewText(NULL);
+ node = xmlNewDocText(ctxt->doc, NULL);
/*
* Scan all chars from the resource and add the to the node