mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-11-08 12:18:42 +00:00
Extend remove_node() with deleting root node
This commit is contained in:
parent
26ac6dca5c
commit
7657d05592
@ -95,9 +95,11 @@ static void
|
||||
remove_node(struct trie_node *node)
|
||||
{
|
||||
assert(node != NULL);
|
||||
assert(node->parent != NULL);
|
||||
assert(node->child[0] == NULL && node->child[1] == NULL);
|
||||
|
||||
if (node->parent == NULL)
|
||||
goto free_node;
|
||||
|
||||
if (node->parent->child[0] == node)
|
||||
node->parent->child[0] = NULL;
|
||||
else if (node->parent->child[1] == node)
|
||||
@ -105,7 +107,8 @@ remove_node(struct trie_node *node)
|
||||
else
|
||||
bug("Invalid child pointer");
|
||||
|
||||
sl_free(node);
|
||||
free_node:
|
||||
sl_free(node);
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user