X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=src%2Fsplay_tree.c;h=d84948ed64aaa9f0ae7e27963ca200b509d9c320;hb=8fde91038538d01aaa5b36ebb06b516a8c313364;hp=aed91561d577ba734e902d88e2141daf73410924;hpb=a86faaf34711d6b0f278b670d70a229a3cf0d479;p=meshlink diff --git a/src/splay_tree.c b/src/splay_tree.c index aed91561..d84948ed 100644 --- a/src/splay_tree.c +++ b/src/splay_tree.c @@ -1,6 +1,6 @@ /* splay_tree.c -- splay tree and linked list convenience - Copyright (C) 2004-2013 Guus Sliepen + Copyright (C) 2014 Guus Sliepen This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -55,7 +55,7 @@ static splay_node_t *splay_top_down(splay_tree_t *tree, const void *data, int *r grandchild->parent = NULL; root = grandchild; - } else if (c > 0 && (grandchild = child->right)) { + } else if(c > 0 && (grandchild = child->right)) { leftbottom->right = child; child->parent = leftbottom; leftbottom = child; @@ -99,7 +99,7 @@ static splay_node_t *splay_top_down(splay_tree_t *tree, const void *data, int *r grandchild->parent = NULL; root = grandchild; - } else if (c < 0 && (grandchild = child->left)) { + } else if(c < 0 && (grandchild = child->left)) { rightbottom->left = child; child->parent = rightbottom; rightbottom = child; @@ -125,9 +125,8 @@ static splay_node_t *splay_top_down(splay_tree_t *tree, const void *data, int *r root = child; break; } - } else { + } else break; - } } /* Merge trees */ @@ -328,9 +327,8 @@ splay_node_t *splay_search_closest_node_nosplay(const splay_tree_t *tree, const node = node->right; else break; - } else { + } else break; - } } if(result) @@ -513,9 +511,8 @@ void splay_unlink_node(splay_tree_t *tree, splay_node_t *node) { } else if(node->next) { tree->root = node->right; node->right->parent = NULL; - } else { + } else tree->root = NULL; - } tree->count--; }