slist: Make sys_slist_find_and_remove return bool
This enables checking if the node is removed or not. Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This commit is contained in:
parent
3910056505
commit
1ba3e9cd1a
|
@ -414,8 +414,10 @@ static inline void sys_slist_remove(sys_slist_t *list,
|
|||
*
|
||||
* @param list A pointer on the list to affect
|
||||
* @param node A pointer on the node to remove from the list
|
||||
*
|
||||
* @return true if node was removed
|
||||
*/
|
||||
static inline void sys_slist_find_and_remove(sys_slist_t *list,
|
||||
static inline bool sys_slist_find_and_remove(sys_slist_t *list,
|
||||
sys_snode_t *node)
|
||||
{
|
||||
sys_snode_t *prev = NULL;
|
||||
|
@ -424,11 +426,13 @@ static inline void sys_slist_find_and_remove(sys_slist_t *list,
|
|||
SYS_SLIST_FOR_EACH_NODE(list, test) {
|
||||
if (test == node) {
|
||||
sys_slist_remove(list, prev, node);
|
||||
break;
|
||||
return true;
|
||||
}
|
||||
|
||||
prev = test;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue