[libxml2] Fix XPath '//' optimization with predicates



commit b4bcba23f64b71105514875f165a63d4cc720609
Author: Nick Wellnhofer <wellnhofer aevum de>
Date:   Mon Aug 5 00:15:11 2013 +0200

    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]'.

 xpath.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/xpath.c b/xpath.c
index fc9eabb..09adb00 100644
--- a/xpath.c
+++ b/xpath.c
@@ -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];
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]