mirror of
https://gitlab.labs.nic.cz/labs/bird.git
synced 2024-05-11 16:54:54 +00:00
Initial BFD commit, work in progress.
This commit is contained in:
21
lib/lists.c
21
lib/lists.c
@@ -100,6 +100,27 @@ rem_node(node *n)
|
||||
x->prev = z;
|
||||
}
|
||||
|
||||
/**
|
||||
* replace_node - replace a node in a list with another one
|
||||
* @old: node to be removed
|
||||
* @new: node to be inserted
|
||||
*
|
||||
* Replaces node @old in the list it's linked in with node @new. Node
|
||||
* @old may be a copy of the original node, which is not accessed
|
||||
* through the list. The function could be called with @old == @new,
|
||||
* which just fixes neighbors' pointers in the case that the node
|
||||
* was reallocated.
|
||||
*/
|
||||
LIST_INLINE void
|
||||
replace_node(node *old, node *new)
|
||||
{
|
||||
old->next->prev = new;
|
||||
old->prev->next = new;
|
||||
|
||||
new->prev = old->prev;
|
||||
new->next = old->next;
|
||||
}
|
||||
|
||||
/**
|
||||
* init_list - create an empty list
|
||||
* @l: list
|
||||
|
Reference in New Issue
Block a user