forked from Mirror/frr
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;
|
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)
|
void list_delete_node(struct list *list, struct listnode *node)
|
||||||
{
|
{
|
||||||
if (node->prev)
|
if (node->prev)
|
||||||
|
|
|
@ -341,6 +341,8 @@ extern void list_add_list(struct list *list, struct list *add);
|
||||||
(L)->count--; \
|
(L)->count--; \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
extern struct listnode *listnode_lookup_nocheck(struct list *list, void *data);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue