assert(node != NULL);
assert(node->child[0] == NULL && node->child[1] == NULL);
- if (node->parent == NULL)
+ if (!node->parent)
;
else
{
/* Defined for other than root nodes */
while (1)
{
- if (node->parent == NULL)
+ if (!node->parent)
return node->bucket;
- if (node->parent->bucket != NULL)
+ if (node->parent->bucket)
return node->parent->bucket;
node = node->parent;
}
/* Root node */
- if (node->parent == NULL)
+ if (!node->parent)
assert(node->bucket != NULL);
- if (node->bucket == NULL)
+ if (!node->bucket)
node->bucket = node->parent->bucket;
for (int i = 0; i < 2; i++)
assert(node != NULL);
assert(trie_slab != NULL);
- if (node->parent == NULL)
+ if (!node->parent)
assert(node->bucket != NULL);
if (is_leaf(node))
static void
third_pass(struct trie_node *node)
{
- if (node == NULL)
+ if (!node)
return;
assert(node->potential_buckets_count <= MAX_POTENTIAL_BUCKETS_COUNT);
/* Root is assigned any of its potential buckets */
- if (node->parent == NULL)
+ if (!node->parent)
{
assert(node->potential_buckets_count > 0);
assert(node->potential_buckets[0] != NULL);
third_pass(node->child[1]);
/* Leaves with no assigned bucket are removed */
- if (node->bucket == NULL && is_leaf(node))
+ if (!node->bucket && is_leaf(node))
remove_node(node);
}
return;
}
- if (node->bucket != NULL)
+ if (node->bucket)
{
create_route_ip4(p, addr, node->bucket);
*count += 1;
return;
}
- if (node->bucket != NULL)
+ if (node->bucket)
{
create_route_ip6(p, addr, node->bucket);
*count += 1;