| Index: third_party/libxml/src/xpath.c
|
| diff --git a/third_party/libxml/src/xpath.c b/third_party/libxml/src/xpath.c
|
| index 1b8587270ffc1edeef34d33f48e8ae31d95c8c6b..dc41ce6b327774adad749c3c58401f485b5a5f0c 100644
|
| --- a/third_party/libxml/src/xpath.c
|
| +++ b/third_party/libxml/src/xpath.c
|
| @@ -14732,12 +14732,8 @@
|
| #endif /* XPATH_STREAMING */
|
|
|
| static void
|
| -xmlXPathOptimizeExpressionInternal(xmlXPathCompExprPtr comp, xmlXPathStepOpPtr op)
|
| +xmlXPathOptimizeExpression(xmlXPathCompExprPtr comp, xmlXPathStepOpPtr op)
|
| {
|
| - /* Already optimized? */
|
| - if (op->cacheURI != 0)
|
| - return;
|
| -
|
| /*
|
| * Try to rewrite "descendant-or-self::node()/foo" to an optimized
|
| * internal representation.
|
| @@ -14788,27 +14784,11 @@
|
| }
|
| }
|
|
|
| - /* Mark the node. */
|
| - op->cacheURI = (void*)(~0);
|
| -
|
| /* Recurse */
|
| if (op->ch1 != -1)
|
| - xmlXPathOptimizeExpressionInternal(comp, &comp->steps[op->ch1]);
|
| + xmlXPathOptimizeExpression(comp, &comp->steps[op->ch1]);
|
| if (op->ch2 != -1)
|
| - xmlXPathOptimizeExpressionInternal(comp, &comp->steps[op->ch2]);
|
| -}
|
| -
|
| -static void
|
| -xmlXPathOptimizeExpression(xmlXPathCompExprPtr comp, int root)
|
| -{
|
| - int i;
|
| - // The expression tree/graph traversal is linear, visiting
|
| - // each node at most once. Mark each xmlXPathStepOp node
|
| - // upon visiting, taking care of clearing out the marks
|
| - // afterwards
|
| - xmlXPathOptimizeExpressionInternal(comp, &comp->steps[root]);
|
| - for (i = 0; i <= root; ++i)
|
| - comp->steps[i].cacheURI = 0;
|
| + xmlXPathOptimizeExpression(comp, &comp->steps[op->ch2]);
|
| }
|
|
|
| /**
|
| @@ -14867,7 +14847,7 @@
|
| comp->nb = 0;
|
| #endif
|
| if ((comp->nbStep > 1) && (comp->last >= 0)) {
|
| - xmlXPathOptimizeExpression(comp, comp->last);
|
| + xmlXPathOptimizeExpression(comp, &comp->steps[comp->last]);
|
| }
|
| }
|
| return(comp);
|
| @@ -15049,7 +15029,8 @@
|
| (ctxt->comp->nbStep > 1) &&
|
| (ctxt->comp->last >= 0))
|
| {
|
| - xmlXPathOptimizeExpression(ctxt->comp, ctxt->comp->last);
|
| + xmlXPathOptimizeExpression(ctxt->comp,
|
| + &ctxt->comp->steps[ctxt->comp->last]);
|
| }
|
| }
|
| CHECK_ERROR;
|
|
|