X-Git-Url: https://wimlib.net/git/?a=blobdiff_plain;f=src%2Frbtree.c;h=10d1dc7c111cc74592d66c515aee613b972a9ea9;hb=9b3bd8bf81681c6ac3216f62bbf7c7cf63e9bb17;hp=71a2c533e1fbbbdaec30e99bf67225402f5ab8c3;hpb=eb34f70aa8288124da89838c7a71f2a49fb8def5;p=wimlib diff --git a/src/rbtree.c b/src/rbtree.c index 71a2c533..10d1dc7c 100644 --- a/src/rbtree.c +++ b/src/rbtree.c @@ -21,7 +21,12 @@ linux/lib/rbtree.c */ -#include "rbtree.h" +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include "wimlib/rbtree.h" +#include /* * red-black trees properties: http://en.wikipedia.org/wiki/Rbtree @@ -63,13 +68,13 @@ struct rb_augment_callbacks { static inline void rb_set_parent(struct rb_node *rb, struct rb_node *p) { - rb->__rb_parent_color = rb_color(rb) | (unsigned long)p; + rb->__rb_parent_color = rb_color(rb) | (uintptr_t)p; } static inline void rb_set_parent_color(struct rb_node *rb, struct rb_node *p, int color) { - rb->__rb_parent_color = (unsigned long)p | color; + rb->__rb_parent_color = (uintptr_t)p | color; } static inline void rb_set_black(struct rb_node *rb) @@ -278,7 +283,7 @@ rb_erase_augmented(struct rb_node *node, struct rb_root *root, { struct rb_node *child = node->rb_right, *tmp = node->rb_left; struct rb_node *parent, *rebalance; - unsigned long pc; + uintptr_t pc; if (!tmp) { /* @@ -358,7 +363,7 @@ rb_erase_augmented(struct rb_node *node, struct rb_root *root, rb_set_parent_color(child2, parent, RB_BLACK); rebalance = NULL; } else { - unsigned long pc2 = successor->__rb_parent_color; + uintptr_t pc2 = successor->__rb_parent_color; successor->__rb_parent_color = pc; rebalance = __rb_is_black(pc2) ? parent : NULL; }