From 2049ce09ed30f4e1bae40e0828c57cfd7c6a1c2d Mon Sep 17 00:00:00 2001 From: "carlosgp143@gmail.com" Date: Thu, 31 May 2018 10:11:56 +0200 Subject: [PATCH] Changed return from int to bool --- os/lib/list.c | 6 +++--- os/lib/list.h | 4 +++- .../code-data-structures/test-data-structures.c | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/os/lib/list.c b/os/lib/list.c index f584ebb3e..9eaf1945e 100644 --- a/os/lib/list.c +++ b/os/lib/list.c @@ -334,16 +334,16 @@ list_item_next(void *item) * 0 if the list does not contain the item, and 1 if the item * is present in the list. */ -int +bool list_contains(list_t list, void *item) { struct list *l; for(l = *list; l != NULL; l = l->next) { if(item == l) { - return 1; + return true; } } - return 0; + return false; } /*---------------------------------------------------------------------------*/ /** @} */ diff --git a/os/lib/list.h b/os/lib/list.h index e4c948665..af0136435 100644 --- a/os/lib/list.h +++ b/os/lib/list.h @@ -66,6 +66,8 @@ #ifndef LIST_H_ #define LIST_H_ +#include + #define LIST_CONCAT2(s1, s2) s1##s2 #define LIST_CONCAT(s1, s2) LIST_CONCAT2(s1, s2) @@ -151,7 +153,7 @@ void list_insert(list_t list, void *previtem, void *newitem); void * list_item_next(void *item); -int list_contains(list_t list, void *item); +bool list_contains(list_t list, void *item); #endif /* LIST_H_ */ diff --git a/tests/07-simulation-base/code-data-structures/test-data-structures.c b/tests/07-simulation-base/code-data-structures/test-data-structures.c index 0bdc8e6c4..da3833dc3 100644 --- a/tests/07-simulation-base/code-data-structures/test-data-structures.c +++ b/tests/07-simulation-base/code-data-structures/test-data-structures.c @@ -167,7 +167,7 @@ UNIT_TEST(test_list) UNIT_TEST_ASSERT(list_contains(lst, &elements[3])); int i; for(i=4; i