mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-04-29 03:55:20 +00:00
lib: add lookup utility routine that accepts null list values
lists passed as parameter that are null, are accepted by the function. I would even propose to silently return NULL in official listnode_lookup() routine. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
This commit is contained in:
parent
3e3708cbd3
commit
2fe55afeec
@ -259,6 +259,13 @@ struct listnode *listnode_lookup(struct list *list, void *data)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct listnode *listnode_lookup_nocheck(struct list *list, void *data)
|
||||
{
|
||||
if (!list)
|
||||
return NULL;
|
||||
return listnode_lookup(list, data);
|
||||
}
|
||||
|
||||
void list_delete_node(struct list *list, struct listnode *node)
|
||||
{
|
||||
if (node->prev)
|
||||
|
@ -341,6 +341,8 @@ extern void list_add_list(struct list *list, struct list *add);
|
||||
(L)->count--; \
|
||||
} while (0)
|
||||
|
||||
extern struct listnode *listnode_lookup_nocheck(struct list *list, void *data);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user