summaryrefslogtreecommitdiff
path: root/debian/patches/0014-Fix-previous-change-to-node-sort-order.patch
blob: 4ff344b96b18325991e93454b6cdee3cef34bc74 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
From: Nick Wellnhofer <wellnhofer@aevum.de>
Date: Sat, 11 Jul 2015 14:27:34 +0200
Subject: Fix previous change to node sort order

Commit ba58f23 broke comparison of nodes from different documents.
Thanks to Olli Pottonen for the report.
---
 xpath.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/xpath.c b/xpath.c
index 95559b3..e60f4e5 100644
--- a/xpath.c
+++ b/xpath.c
@@ -361,14 +361,14 @@ turtle_comparison:
     /*
      * compute depth to root
      */
-    for (depth2 = 0, cur = node2; cur != NULL; cur = cur->parent) {
-	if (cur == node1)
+    for (depth2 = 0, cur = node2; cur->parent != NULL; cur = cur->parent) {
+	if (cur->parent == node1)
 	    return(1);
 	depth2++;
     }
     root = cur;
-    for (depth1 = 0, cur = node1; cur != NULL; cur = cur->parent) {
-	if (cur == node2)
+    for (depth1 = 0, cur = node1; cur->parent != NULL; cur = cur->parent) {
+	if (cur->parent == node2)
 	    return(-1);
 	depth1++;
     }