1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-10-24 13:33:01 +03:00

Fix order of root nodes

Make sure root nodes are sorted before other nodes.
This commit is contained in:
Nick Wellnhofer
2015-03-08 16:44:11 +01:00
parent f6aaabce85
commit ba58f23c60

View File

@@ -361,13 +361,13 @@ turtle_comparison:
/* /*
* compute depth to root * compute depth to root
*/ */
for (depth2 = 0, cur = node2;cur->parent != NULL;cur = cur->parent) { for (depth2 = 0, cur = node2; cur != NULL; cur = cur->parent) {
if (cur == node1) if (cur == node1)
return(1); return(1);
depth2++; depth2++;
} }
root = cur; root = cur;
for (depth1 = 0, cur = node1;cur->parent != NULL;cur = cur->parent) { for (depth1 = 0, cur = node1; cur != NULL; cur = cur->parent) {
if (cur == node2) if (cur == node2)
return(-1); return(-1);
depth1++; depth1++;