From 6cbec1b211e982ea3148d3528c8df9c8da0aa02f Mon Sep 17 00:00:00 2001 From: Geoffrey Allott Date: Sat, 3 Sep 2022 13:37:53 +0100 Subject: [PATCH] clean up node_sort_sons --- src/stree.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/stree.c b/src/stree.c index 81122f3..77aa7f1 100644 --- a/src/stree.c +++ b/src/stree.c @@ -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; } -- 2.34.1