From: Mathieu Desnoyers Date: Mon, 22 Mar 2010 19:09:23 +0000 (-0400) Subject: Add assertions in fixup X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=ba16c81feaa665a0f782b952a0c6ce435016c5e0;p=userspace-rcu.git Add assertions in fixup Signed-off-by: Mathieu Desnoyers --- diff --git a/urcu-rbtree.c b/urcu-rbtree.c index d0e6c88..ac55fd8 100644 --- a/urcu-rbtree.c +++ b/urcu-rbtree.c @@ -37,6 +37,8 @@ #include #include +#define DEBUG + #ifdef DEBUG #define dbg_printf(args...) printf(args) #else @@ -526,6 +528,8 @@ static void rcu_rbtree_remove_fixup(struct rcu_rbtree_node **root, struct rcu_rbtree_node *w, *t; w = x->p->right; + assert(w != &rcu_rbtree_nil); + if (w->color == COLOR_RED) { w->color == COLOR_BLACK; x->p->color = COLOR_RED; @@ -555,6 +559,8 @@ static void rcu_rbtree_remove_fixup(struct rcu_rbtree_node **root, struct rcu_rbtree_node *w, *t; w = x->p->left; + assert(w != &rcu_rbtree_nil); + if (w->color == COLOR_RED) { w->color == COLOR_BLACK; x->p->color = COLOR_RED;