diff options
author | Anuradha Karuppiah <anuradhak@cumulusnetworks.com> | 2019-03-19 19:39:51 +0100 |
---|---|---|
committer | Anuradha Karuppiah <anuradhak@cumulusnetworks.com> | 2019-04-20 17:33:20 +0200 |
commit | 315999e9b424b5824c28796ba62e43df1bb4cf2c (patch) | |
tree | 3b5886e3e505c5a024bfe544dbbeede0fccea0c4 /lib/linklist.c | |
parent | lib: move SG prefix2str APIs from pimd to lib (diff) | |
download | frr-315999e9b424b5824c28796ba62e43df1bb4cf2c.tar.xz frr-315999e9b424b5824c28796ba62e43df1bb4cf2c.zip |
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>
Diffstat (limited to 'lib/linklist.c')
-rw-r--r-- | lib/linklist.c | 4 |
1 files changed, 3 insertions, 1 deletions
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) |