- xpath.c include/libxml/xpath.h include/libxml/xpathInternals.h:
lot of optimization work, results in significant improvements
when handling really complex XPath queries. Add a small optimizer
for unions, improve [n] and [last()], avoid some costly ops.
Daniel
diff --git a/include/libxml/xpath.h b/include/libxml/xpath.h
index a330e38..3755678 100644
--- a/include/libxml/xpath.h
+++ b/include/libxml/xpath.h
@@ -255,6 +255,7 @@
xmlXPathCompExprPtr comp; /* the precompiled expression */
int xptr; /* it this an XPointer expression */
+ xmlNodePtr ancestor; /* used for walking preceding axis */
};
/**
diff --git a/include/libxml/xpathInternals.h b/include/libxml/xpathInternals.h
index 7f3f75e..40c3bce 100644
--- a/include/libxml/xpathInternals.h
+++ b/include/libxml/xpathInternals.h
@@ -75,6 +75,17 @@
XP_ERROR(XPATH_INVALID_TYPE)
/**
+ * CHECK_TYPE0:
+ * @typeval: the XPath type
+ *
+ * Macro to check that the value on top of the XPath stack is of a given
+ * type. return(0) in case of failure
+ */
+#define CHECK_TYPE0(typeval) \
+ if ((ctxt->value == NULL) || (ctxt->value->type != typeval)) \
+ XP_ERROR0(XPATH_INVALID_TYPE)
+
+/**
* CHECK_ARITY:
* @x: the number of expected args
*