clean up node_sort_sons
authorGeoffrey Allott <geoffrey@allott.email>
Sat, 3 Sep 2022 12:37:53 +0000 (13:37 +0100)
committerGeoffrey Allott <geoffrey@allott.email>
Sat, 3 Sep 2022 12:37:53 +0000 (13:37 +0100)
src/stree.c

index 81122f3ed049fb1f2a18b6c411e9b64192b17fe9..77aa7f1b85e327dfad7e44d99e1f7820c17862d3 100644 (file)
@@ -71,17 +71,13 @@ static void node_sort_sons(struct node *self)
 
     for (brother = (struct node *) 0, node = self->son; node && node->brother; brother = node, node = node->brother) {
         if (node->to > node->brother->to) {
-            if (brother) {
-                tmp = node->brother;
-                node->brother = node->brother->brother;
-                tmp->brother = node;
+            tmp = node->brother;
+            node->brother = node->brother->brother;
+            tmp->brother = node;
+            if (brother)
                 brother->brother = tmp;
-            } else {
-                tmp = node->brother;
-                node->brother = node->brother->brother;
-                tmp->brother = node;
+            else
                 self->son = tmp;
-            }
             brother = (struct node *) 0;
             node = self->son;
         }