mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-07-29 11:41:22 +03:00
fixed a typo pointed out by Igor try to speed up node compare using line
* globals.c: fixed a typo pointed out by Igor * xpath.c: try to speed up node compare using line numbers if available. Daniel
This commit is contained in:
15
xpath.c
15
xpath.c
@ -1367,6 +1367,21 @@ xmlXPathCmpNodes(xmlNodePtr node1, xmlNodePtr node2) {
|
||||
if (node1 == node2->next)
|
||||
return(-1);
|
||||
|
||||
/*
|
||||
* Speedup using line numbers if availble.
|
||||
*/
|
||||
if ((node1->type == XML_ELEMENT_NODE) &&
|
||||
(node2->type == XML_ELEMENT_NODE) &&
|
||||
(0 != (int) node1->content) && (0 != (int) node2->content)) {
|
||||
int l1, l2;
|
||||
l1 = (int) node1->content;
|
||||
l2 = (int) node2->content;
|
||||
if (l1 < l2)
|
||||
return(1);
|
||||
if (l1 > l2)
|
||||
return(-1);
|
||||
}
|
||||
|
||||
/*
|
||||
* compute depth to root
|
||||
*/
|
||||
|
Reference in New Issue
Block a user