rbtree

diff src/rbtree.c @ 14:1b8a3a6088b6

simplified find_min
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 02 Nov 2014 10:56:08 +0200
parents 5b955b3a4675
children 1b77b72688fe
line diff
     1.1 --- a/src/rbtree.c	Thu Apr 17 13:35:43 2014 +0300
     1.2 +++ b/src/rbtree.c	Sun Nov 02 10:56:08 2014 +0200
     1.3 @@ -421,15 +421,13 @@
     1.4  
     1.5  static struct rbnode *find_min(struct rbnode *tree)
     1.6  {
     1.7 -	struct rbnode *node;
     1.8 -
     1.9  	if(!tree)
    1.10  		return 0;
    1.11  
    1.12 -	while(node->left) {
    1.13 -		node = node->left;
    1.14 +	while(tree->left) {
    1.15 +		tree = tree->left;
    1.16  	}
    1.17 -	return node;
    1.18 +	return tree;
    1.19  }
    1.20  
    1.21  static struct rbnode *del_min(struct rbtree *rb, struct rbnode *tree)