Commit f49be477 authored by Daniel Veillard's avatar Daniel Veillard

applied optimization patch from Petr Pajas Daniel

* xpath.c: applied optimization patch from Petr Pajas
Daniel
parent ab69f366
Tue Feb 17 12:47:20 CET 2004 Daniel Veillard <daniel@veillard.com>
* xpath.c: applied optimization patch from Petr Pajas
Tue Feb 17 12:39:08 CET 2004 Daniel Veillard <daniel@veillard.com>
* xmlwriter.c include/libxml/xmlwriter.h: applied update
......
......@@ -1616,8 +1616,28 @@ xmlXPathCmpNodes(xmlNodePtr node1, xmlNodePtr node2) {
/*
* Find who's first.
*/
if (node1 == node2->prev)
return(1);
if (node1 == node2->next)
return(-1);
/*
* Speedup using document order if availble.
*/
if ((node1->type == XML_ELEMENT_NODE) &&
(node2->type == XML_ELEMENT_NODE) &&
(0 > (long) node1->content) &&
(0 > (long) node2->content) &&
(node1->doc == node2->doc)) {
long l1, l2;
l1 = -((long) node1->content);
l2 = -((long) node2->content);
if (l1 < l2)
return(1);
if (l1 > l2)
return(-1);
}
for (cur = node1->next;cur != NULL;cur = cur->next)
if (cur == node2)
return(1);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment