1
0
mirror of https://gitlab.gnome.org/GNOME/libxslt synced 2025-08-08 21:42:07 +03:00

Explain why we have to mess with 'boolval' of value trees

This commit is contained in:
Nick Wellnhofer
2023-12-20 19:04:51 +01:00
parent c5c66dfbf5
commit 73b955aea0
2 changed files with 14 additions and 6 deletions

View File

@@ -793,7 +793,11 @@ exsltFuncResultElem (xsltTransformContextPtr ctxt,
"exsltFuncResultElem: ret == NULL\n"); "exsltFuncResultElem: ret == NULL\n");
data->error = 1; data->error = 1;
} else { } else {
ret->boolval = 0; /* Freeing is not handled there anymore */ /*
* This stops older libxml2 versions from freeing the nodes
* in the tree.
*/
ret->boolval = 0;
} }
} else { } else {
/* If the func:result element has empty content and does not /* If the func:result element has empty content and does not

View File

@@ -1010,10 +1010,10 @@ xsltEvalVariable(xsltTransformContextPtr ctxt, xsltStackElemPtr variable,
if (result == NULL) { if (result == NULL) {
result = xmlXPathNewCString(""); result = xmlXPathNewCString("");
} else { } else {
/* /*
* Freeing is not handled there anymore. * This stops older libxml2 versions from freeing the nodes
* QUESTION TODO: What does the above comment mean? * in the tree.
*/ */
result->boolval = 0; result->boolval = 0;
} }
#ifdef WITH_XSLT_DEBUG_VARIABLE #ifdef WITH_XSLT_DEBUG_VARIABLE
@@ -1232,7 +1232,11 @@ xsltEvalGlobalVariable(xsltStackElemPtr elem, xsltTransformContextPtr ctxt)
if (result == NULL) { if (result == NULL) {
result = xmlXPathNewCString(""); result = xmlXPathNewCString("");
} else { } else {
result->boolval = 0; /* Freeing is not handled there anymore */ /*
* This stops older libxml2 versions from freeing the nodes
* in the tree.
*/
result->boolval = 0;
} }
#ifdef WITH_XSLT_DEBUG_VARIABLE #ifdef WITH_XSLT_DEBUG_VARIABLE
#ifdef LIBXML_DEBUG_ENABLED #ifdef LIBXML_DEBUG_ENABLED