From 315999e9b424b5824c28796ba62e43df1bb4cf2c Mon Sep 17 00:00:00 2001 From: Anuradha Karuppiah Date: Tue, 19 Mar 2019 11:39:51 -0700 Subject: 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 --- lib/linklist.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib/linklist.c') diff --git a/lib/linklist.c b/lib/linklist.c index f0d0c2924..d3ecc0030 100644 --- a/lib/linklist.c +++ b/lib/linklist.c @@ -50,7 +50,7 @@ static void listnode_free(struct listnode *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; @@ -68,6 +68,8 @@ void listnode_add(struct list *list, void *val) list->tail = node; list->count++; + + return node; } void listnode_add_head(struct list *list, void *val) -- cgit v1.2.3