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:
Luiz Augusto von Dentz 2017-06-12 14:27:53 +03:00 committed by Johan Hedberg
parent 3910056505
commit 1ba3e9cd1a
1 changed files with 6 additions and 2 deletions

View File

@ -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;
}