1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2024-12-28 07:21:26 +03:00

Fix XPath '//' optimization with predicates

My attempt to optimize XPath expressions containing '//' caused a
regression reported in bug #695699. This commit disables the
optimization for expressions of the form '//foo[predicate]'.
This commit is contained in:
Nick Wellnhofer 2013-08-05 00:15:11 +02:00
parent ff76eb28c7
commit b4bcba23f6

View File

@ -14724,8 +14724,9 @@ xmlXPathOptimizeExpression(xmlXPathCompExprPtr comp, xmlXPathStepOpPtr op)
* internal representation.
*/
if ((op->ch1 != -1) &&
(op->op == XPATH_OP_COLLECT /* 11 */))
if ((op->op == XPATH_OP_COLLECT /* 11 */) &&
(op->ch1 != -1) &&
(op->ch2 == -1 /* no predicate */))
{
xmlXPathStepOpPtr prevop = &comp->steps[op->ch1];