Skip to content

Commit

Permalink
Fix XPath '//' optimization with predicates
Browse files Browse the repository at this point in the history
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]'.
  • Loading branch information
nwellnhof committed Aug 4, 2013
1 parent ff76eb2 commit b4bcba2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions xpath.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];

Expand Down

0 comments on commit b4bcba2

Please sign in to comment.