NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: lib/47144 (rbtree itteration is broken)



Jeremy Huddleston Sequoia <jeremyhu%apple.com@localhost> wrote:
> RB_TREE_MIN and RB_TREE_MAX also need to be fixed:
> 
> Index: rbtree.h
> ===================================================================
> --- rbtree.h  (revision 84264)
> +++ rbtree.h  (working copy)
> @@ -95,8 +95,8 @@
>    } while (/*CONSTCOND*/ 0)
>  } rb_node_t;
>  
> -#define RB_TREE_MIN(T) rb_tree_iterate((T), NULL, RB_DIR_LEFT)
> -#define RB_TREE_MAX(T) rb_tree_iterate((T), NULL, RB_DIR_RIGHT)
> +#define RB_TREE_MIN(T) rb_tree_iterate((T), NULL, RB_DIR_RIGHT)
> +#define RB_TREE_MAX(T) rb_tree_iterate((T), NULL, RB_DIR_LEFT)
>  #define RB_TREE_FOREACH(N, T) \
>      for ((N) = RB_TREE_MIN(T); (N); \
>       (N) = rb_tree_iterate((T), (N), RB_DIR_RIGHT))

Well, it does not.. the current behaviour of rb_tree_iterate() returns
the left-most node, which *is* the minimum.

-- 
Mindaugas


Home | Main Index | Thread Index | Old Index