Remove the warnings when IP_DONTFRAGMENT/IPV6-DONTFRAG is not supported.
[tinc] / src / avl_tree.c
index a8bf5d5..22d7ff5 100644 (file)
@@ -168,14 +168,12 @@ static void avl_rebalance(avl_tree_t *tree, avl_node_t *node)
                                                child->right->parent = child;
                                        gchild->right = node;
 
-                                       if(gchild->right)
-                                               gchild->right->parent = gchild;
+                                       gchild->right->parent = gchild;
                                        gchild->left = child;
 
-                                       if(gchild->left)
-                                               gchild->left->parent = gchild;
-                                       *superparent = gchild;
+                                       gchild->left->parent = gchild;
 
+                                       *superparent = gchild;
                                        gchild->parent = parent;
 #ifdef AVL_COUNT
                                        node->count = AVL_CALC_COUNT(node);
@@ -224,12 +222,10 @@ static void avl_rebalance(avl_tree_t *tree, avl_node_t *node)
                                                child->left->parent = child;
                                        gchild->left = node;
 
-                                       if(gchild->left)
-                                               gchild->left->parent = gchild;
+                                       gchild->left->parent = gchild;
                                        gchild->right = child;
 
-                                       if(gchild->right)
-                                               gchild->right->parent = gchild;
+                                       gchild->right->parent = gchild;
 
                                        *superparent = gchild;
                                        gchild->parent = parent;
@@ -600,6 +596,8 @@ void avl_unlink_node(avl_tree_t *tree, avl_node_t *node)
                balnode = parent;
        } else {
                subst = node->prev;
+               if(!subst) // This only happens if node is not actually in a tree at all.
+                       abort();
 
                if(subst == left) {
                        balnode = subst;