char const *type; //!< Talloc type to check elements against.
uint64_t num_elements; //!< How many elements are inside the tree.
- fr_rb_cmp_t compare; //!< The comparator.
+ fr_rb_cmp_t compare; //!< The comparator.
fr_rb_free_t free; //!< Free function called when a node is freed.
bool replace; //!< Allow replacements.
/* establish y->parent link */
if (y != NIL) y->parent = x->parent;
- if (x->parent) {
+ if (x->parent != NIL) {
if (x == x->parent->left) {
x->parent->left = y;
} else {
/* establish y->parent link */
if (y != NIL) y->parent = x->parent;
- if (x->parent) {
+ if (x->parent != NIL) {
if (x == x->parent->right) {
x->parent->right = y;
} else {
/* find where node belongs */
current = tree->root;
- parent = NULL;
+ parent = NIL;
while (current != NIL) {
int result;
};
/* insert node in tree */
- if (parent) {
+ if (parent != NIL) {
if (tree->compare(data, parent->data) <= 0) {
parent->left = x;
} else {
parent = y->parent;
if (x != NIL) x->parent = parent;
- if (parent) {
+ if (parent != NIL) {
if (y == parent->left) {
parent->left = x;
} else {
memcpy(y, z, sizeof(*y));
y->data = y_data;
- if (!y->parent) {
+ if (y->parent == NIL) {
tree->root = y;
} else {
if (y->parent->left == z) y->parent->left = y;
x = x->right;
goto descend;
}
- while (x->parent) {
+ while (x->parent != NIL) {
if (x->parent->left == x) {
x = x->parent;
goto visit;