From 73b955aea0f554b18253d93638c7cedbc73e706f Mon Sep 17 00:00:00 2001 From: Nick Wellnhofer Date: Wed, 20 Dec 2023 19:04:51 +0100 Subject: [PATCH] Explain why we have to mess with 'boolval' of value trees --- libexslt/functions.c | 6 +++++- libxslt/variables.c | 14 +++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/libexslt/functions.c b/libexslt/functions.c index 56f1dbdb..8d35a7ae 100644 --- a/libexslt/functions.c +++ b/libexslt/functions.c @@ -793,7 +793,11 @@ exsltFuncResultElem (xsltTransformContextPtr ctxt, "exsltFuncResultElem: ret == NULL\n"); data->error = 1; } 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 { /* If the func:result element has empty content and does not diff --git a/libxslt/variables.c b/libxslt/variables.c index c0055c21..93cb0747 100644 --- a/libxslt/variables.c +++ b/libxslt/variables.c @@ -1010,10 +1010,10 @@ xsltEvalVariable(xsltTransformContextPtr ctxt, xsltStackElemPtr variable, if (result == NULL) { result = xmlXPathNewCString(""); } else { - /* - * Freeing is not handled there anymore. - * QUESTION TODO: What does the above comment mean? - */ + /* + * This stops older libxml2 versions from freeing the nodes + * in the tree. + */ result->boolval = 0; } #ifdef WITH_XSLT_DEBUG_VARIABLE @@ -1232,7 +1232,11 @@ xsltEvalGlobalVariable(xsltStackElemPtr elem, xsltTransformContextPtr ctxt) if (result == NULL) { result = xmlXPathNewCString(""); } 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 LIBXML_DEBUG_ENABLED