mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-13 22:26:14 +00:00
lib: linklist: clean up insert-before/after dups
- list_add_node_next was in fact unused - list_add_node_prev performs a subset of listnode_add_before and its only use in isisd replaced with that. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
This commit is contained in:
parent
1c6f50bf2d
commit
a8fd820281
@ -545,13 +545,13 @@ isis_spf_add2tent (struct isis_spftree *spftree, enum vertextype vtype,
|
||||
v = listgetdata (node);
|
||||
if (v->d_N > vertex->d_N)
|
||||
{
|
||||
list_add_node_prev (spftree->tents, node, vertex);
|
||||
listnode_add_before (spftree->tents, node, vertex);
|
||||
break;
|
||||
}
|
||||
else if (v->d_N == vertex->d_N && v->type > vertex->type)
|
||||
{
|
||||
/* Tie break, add according to type */
|
||||
list_add_node_prev (spftree->tents, node, vertex);
|
||||
listnode_add_before (spftree->tents, node, vertex);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ listnode_add_sort (struct list *list, void *val)
|
||||
list->count++;
|
||||
}
|
||||
|
||||
void
|
||||
struct listnode *
|
||||
listnode_add_after (struct list *list, struct listnode *pp, void *val)
|
||||
{
|
||||
struct listnode *nn;
|
||||
@ -157,6 +157,7 @@ listnode_add_after (struct list *list, struct listnode *pp, void *val)
|
||||
pp->next = nn;
|
||||
}
|
||||
list->count++;
|
||||
return nn;
|
||||
}
|
||||
|
||||
struct listnode *
|
||||
@ -304,52 +305,6 @@ list_delete_node (struct list *list, struct listnode *node)
|
||||
listnode_free (node);
|
||||
}
|
||||
|
||||
/* ospf_spf.c */
|
||||
void
|
||||
list_add_node_prev (struct list *list, struct listnode *current, void *val)
|
||||
{
|
||||
struct listnode *node;
|
||||
|
||||
assert (val != NULL);
|
||||
|
||||
node = listnode_new ();
|
||||
node->next = current;
|
||||
node->data = val;
|
||||
|
||||
if (current->prev == NULL)
|
||||
list->head = node;
|
||||
else
|
||||
current->prev->next = node;
|
||||
|
||||
node->prev = current->prev;
|
||||
current->prev = node;
|
||||
|
||||
list->count++;
|
||||
}
|
||||
|
||||
/* ospf_spf.c */
|
||||
void
|
||||
list_add_node_next (struct list *list, struct listnode *current, void *val)
|
||||
{
|
||||
struct listnode *node;
|
||||
|
||||
assert (val != NULL);
|
||||
|
||||
node = listnode_new ();
|
||||
node->prev = current;
|
||||
node->data = val;
|
||||
|
||||
if (current->next == NULL)
|
||||
list->tail = node;
|
||||
else
|
||||
current->next->prev = node;
|
||||
|
||||
node->next = current->next;
|
||||
current->next = node;
|
||||
|
||||
list->count++;
|
||||
}
|
||||
|
||||
/* ospf_spf.c */
|
||||
void
|
||||
list_add_list (struct list *l, struct list *m)
|
||||
|
@ -67,7 +67,7 @@ extern void list_free (struct list *);
|
||||
|
||||
extern void listnode_add (struct list *, void *);
|
||||
extern void listnode_add_sort (struct list *, void *);
|
||||
extern void listnode_add_after (struct list *, struct listnode *, void *);
|
||||
extern struct listnode *listnode_add_after (struct list *, struct listnode *, void *);
|
||||
extern struct listnode *listnode_add_before (struct list *, struct listnode *, void *);
|
||||
extern void listnode_move_to_tail (struct list *, struct listnode *);
|
||||
extern void listnode_delete (struct list *, void *);
|
||||
@ -81,8 +81,6 @@ extern void list_delete_all_node (struct list *);
|
||||
extern void list_delete_node (struct list *, struct listnode *);
|
||||
|
||||
/* For ospf_spf.c */
|
||||
extern void list_add_node_prev (struct list *, struct listnode *, void *);
|
||||
extern void list_add_node_next (struct list *, struct listnode *, void *);
|
||||
extern void list_add_list (struct list *, struct list *);
|
||||
|
||||
/* List iteration macro.
|
||||
|
Loading…
Reference in New Issue
Block a user