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]'.
diff --git a/xpath.c b/xpath.c
index fc9eabb..09adb00 100644
--- a/xpath.c
+++ b/xpath.c
@@ -14724,8 +14724,9 @@
* 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];