#include "config.h"
+#include <assert.h>
#include "red_black_tree.h"
#include "stdio.h"
y->left=x;
x->parent=y;
-#ifdef DEBUG_ASSERT
- Assert(!tree->nil->red,"nil not red in LeftRotate");
-#endif
+ assert(!tree->nil->red && "nil not red in LeftRotate");
}
x->right=y;
y->parent=x;
-#ifdef DEBUG_ASSERT
- Assert(!tree->nil->red,"nil not red in RightRotate");
-#endif
+ assert(!tree->nil->red && "nil not red in RightRotate");
}
/***********************************************************************/
y->right=z;
}
-#ifdef DEBUG_ASSERT
- Assert(!tree->nil->red,"nil not red in TreeInsertHelp");
-#endif
+ assert(!tree->nil->red && "nil not red in TreeInsertHelp");
}
/* Before calling Insert RBTree the node x should have its key set */
tree->root->left->red=0;
return(newNode);
-#ifdef DEBUG_ASSERT
- Assert(!tree->nil->red,"nil not red in RBTreeInsert");
- Assert(!tree->root->red,"root not red in RBTreeInsert");
-#endif
+ assert(!tree->nil->red && "nil not red in RBTreeInsert");
+ assert(!tree->root->red && "root not red in RBTreeInsert");
}
/***********************************************************************/
}
x->red=0;
-#ifdef DEBUG_ASSERT
- Assert(!tree->nil->red,"nil not black in RBDeleteFixUp");
-#endif
+ assert(!tree->nil->red && "nil not black in RBDeleteFixUp");
}
}
if (y != z) { /* y should not be nil in this case */
-#ifdef DEBUG_ASSERT
- Assert( (y!=tree->nil),"y is nil in RBDelete\n");
-#endif
+ assert(y!=tree->nil && "y is nil in RBDelete");
/* y is the node to splice out and x is its child */
if (!(y->red)) RBDeleteFixUp(tree,x);
free(y);
}
-#ifdef DEBUG_ASSERT
- Assert(!tree->nil->red,"nil not black in RBDelete");
-#endif
+ assert(!tree->nil->red && "nil not black in RBDelete");
}