| Index: third_party/libxslt/libexslt/functions.c
|
| diff --git a/third_party/libxslt/libexslt/functions.c b/third_party/libxslt/libexslt/functions.c
|
| index 0795a13dadddc4cc632981813bb8a5751c1b72e4..b49fbe6c32aa09a3bdfa982a79e2dd9f3e8c171f 100644
|
| --- a/third_party/libxslt/libexslt/functions.c
|
| +++ b/third_party/libxslt/libexslt/functions.c
|
| @@ -35,7 +35,6 @@ struct _exsltFuncData {
|
| xmlHashTablePtr funcs; /* pointer to the stylesheet module data */
|
| xmlXPathObjectPtr result; /* returned by func:result */
|
| int error; /* did an error occur? */
|
| - xmlDocPtr RVT; /* result tree fragment */
|
| };
|
|
|
| typedef struct _exsltFuncResultPreComp exsltFuncResultPreComp;
|
| @@ -57,8 +56,6 @@ static void exsltFuncFunctionFunction (xmlXPathParserContextPtr ctxt,
|
| int nargs);
|
| static exsltFuncFunctionData *exsltFuncNewFunctionData(void);
|
|
|
| -#define MAX_FUNC_RECURSION 1000
|
| -
|
| /*static const xmlChar *exsltResultDataID = (const xmlChar *) "EXSLT Result";*/
|
|
|
| /**
|
| @@ -333,14 +330,6 @@ exsltFuncFunctionFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
| "param == NULL\n");
|
| return;
|
| }
|
| - if (tctxt->funcLevel > MAX_FUNC_RECURSION) {
|
| - xsltGenericError(xsltGenericErrorContext,
|
| - "{%s}%s: detected a recursion\n",
|
| - ctxt->context->functionURI, ctxt->context->function);
|
| - ctxt->error = XPATH_MEMORY_ERROR;
|
| - return;
|
| - }
|
| - tctxt->funcLevel++;
|
|
|
| /*
|
| * We have a problem with the evaluation of function parameters.
|
| @@ -424,10 +413,16 @@ exsltFuncFunctionFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
| xsltFreeStackElemList(params);
|
|
|
| if (data->error != 0)
|
| - goto error;
|
| + return;
|
|
|
| if (data->result != NULL) {
|
| ret = data->result;
|
| + /*
|
| + * IMPORTANT: This enables previously tree fragments marked as
|
| + * being results of a function, to be garbage-collected after
|
| + * the calling process exits.
|
| + */
|
| + xsltFlagRVTs(tctxt, ret, XSLT_RVT_LOCAL);
|
| } else
|
| ret = xmlXPathNewCString("");
|
|
|
| @@ -446,19 +441,10 @@ exsltFuncFunctionFunction (xmlXPathParserContextPtr ctxt, int nargs) {
|
| "executing a function\n",
|
| ctxt->context->functionURI, ctxt->context->function);
|
| xmlFreeNode(fake);
|
| - goto error;
|
| + return;
|
| }
|
| xmlFreeNode(fake);
|
| valuePush(ctxt, ret);
|
| -
|
| -error:
|
| - /*
|
| - * IMPORTANT: This enables previously tree fragments marked as
|
| - * being results of a function, to be garbage-collected after
|
| - * the calling process exits.
|
| - */
|
| - xsltExtensionInstructionResultFinalize(tctxt);
|
| - tctxt->funcLevel--;
|
| }
|
|
|
|
|
| @@ -724,7 +710,7 @@ exsltFuncResultElem (xsltTransformContextPtr ctxt,
|
| * Mark it as a function result in order to avoid garbage
|
| * collecting of tree fragments before the function exits.
|
| */
|
| - xsltExtensionInstructionResultRegister(ctxt, ret);
|
| + xsltFlagRVTs(ctxt, ret, XSLT_RVT_FUNC_RESULT);
|
| } else if (inst->children != NULL) {
|
| /* If the func:result element does not have a select attribute
|
| * and has non-empty content (i.e. the func:result element has
|
| @@ -741,7 +727,8 @@ exsltFuncResultElem (xsltTransformContextPtr ctxt,
|
| data->error = 1;
|
| return;
|
| }
|
| - xsltRegisterLocalRVT(ctxt, container);
|
| + /* Mark as function result. */
|
| + container->psvi = XSLT_RVT_FUNC_RESULT;
|
|
|
| oldInsert = ctxt->insert;
|
| ctxt->insert = (xmlNodePtr) container;
|
| @@ -756,11 +743,6 @@ exsltFuncResultElem (xsltTransformContextPtr ctxt,
|
| data->error = 1;
|
| } else {
|
| ret->boolval = 0; /* Freeing is not handled there anymore */
|
| - /*
|
| - * Mark it as a function result in order to avoid garbage
|
| - * collecting of tree fragments before the function exits.
|
| - */
|
| - xsltExtensionInstructionResultRegister(ctxt, ret);
|
| }
|
| } else {
|
| /* If the func:result element has empty content and does not
|
|
|