lib: fix warning in linklist api

Add return value and comment to new/recent linklist api
to clean up compile warning.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
This commit is contained in:
Mark Stapp 2019-04-22 15:49:16 -04:00
parent 8f19bc1c69
commit 75839aabb8
2 changed files with 8 additions and 2 deletions

View File

@ -328,7 +328,7 @@ void list_sort(struct list *list, int (*cmp)(const void **, const void **))
XFREE(MTYPE_TMP, items); XFREE(MTYPE_TMP, items);
} }
void listnode_add_force(struct list **list, void *val) struct listnode *listnode_add_force(struct list **list, void *val)
{ {
if (*list == NULL) if (*list == NULL)
*list = list_new(); *list = list_new();

View File

@ -343,7 +343,13 @@ extern void list_add_list(struct list *list, struct list *add);
extern struct listnode *listnode_lookup_nocheck(struct list *list, void *data); extern struct listnode *listnode_lookup_nocheck(struct list *list, void *data);
extern void listnode_add_force(struct list **list, void *val); /*
* Add a node to *list, if non-NULL. Otherwise, allocate a new list, mail
* it back in *list, and add a new node.
*
* Return: the new node.
*/
extern struct listnode *listnode_add_force(struct list **list, void *val);
#ifdef __cplusplus #ifdef __cplusplus
} }