mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-06-14 13:22:02 +00:00
lib: return listnode on add for subsequent efficent del
Having to lookup the DLL node to delete it defeats one purpose of using DLLs. Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
This commit is contained in:
parent
c6b6b53b29
commit
315999e9b4
@ -50,7 +50,7 @@ static void listnode_free(struct listnode *node)
|
|||||||
XFREE(MTYPE_LINK_NODE, node);
|
XFREE(MTYPE_LINK_NODE, node);
|
||||||
}
|
}
|
||||||
|
|
||||||
void listnode_add(struct list *list, void *val)
|
struct listnode *listnode_add(struct list *list, void *val)
|
||||||
{
|
{
|
||||||
struct listnode *node;
|
struct listnode *node;
|
||||||
|
|
||||||
@ -68,6 +68,8 @@ void listnode_add(struct list *list, void *val)
|
|||||||
list->tail = node;
|
list->tail = node;
|
||||||
|
|
||||||
list->count++;
|
list->count++;
|
||||||
|
|
||||||
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
void listnode_add_head(struct list *list, void *val)
|
void listnode_add_head(struct list *list, void *val)
|
||||||
|
@ -84,7 +84,7 @@ extern struct list *list_new(void);
|
|||||||
* data
|
* data
|
||||||
* element to add
|
* element to add
|
||||||
*/
|
*/
|
||||||
extern void listnode_add(struct list *list, void *data);
|
extern struct listnode *listnode_add(struct list *list, void *data);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Add a new element to the beginning of a list.
|
* Add a new element to the beginning of a list.
|
||||||
|
Loading…
Reference in New Issue
Block a user