Changed return from int to bool
This commit is contained in:
parent
259f6c06d7
commit
2049ce09ed
|
@ -334,16 +334,16 @@ list_item_next(void *item)
|
||||||
* 0 if the list does not contain the item, and 1 if the item
|
* 0 if the list does not contain the item, and 1 if the item
|
||||||
* is present in the list.
|
* is present in the list.
|
||||||
*/
|
*/
|
||||||
int
|
bool
|
||||||
list_contains(list_t list, void *item)
|
list_contains(list_t list, void *item)
|
||||||
{
|
{
|
||||||
struct list *l;
|
struct list *l;
|
||||||
for(l = *list; l != NULL; l = l->next) {
|
for(l = *list; l != NULL; l = l->next) {
|
||||||
if(item == l) {
|
if(item == l) {
|
||||||
return 1;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
|
@ -66,6 +66,8 @@
|
||||||
#ifndef LIST_H_
|
#ifndef LIST_H_
|
||||||
#define LIST_H_
|
#define LIST_H_
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
#define LIST_CONCAT2(s1, s2) s1##s2
|
#define LIST_CONCAT2(s1, s2) s1##s2
|
||||||
#define LIST_CONCAT(s1, s2) LIST_CONCAT2(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);
|
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_ */
|
#endif /* LIST_H_ */
|
||||||
|
|
||||||
|
|
|
@ -167,7 +167,7 @@ UNIT_TEST(test_list)
|
||||||
UNIT_TEST_ASSERT(list_contains(lst, &elements[3]));
|
UNIT_TEST_ASSERT(list_contains(lst, &elements[3]));
|
||||||
int i;
|
int i;
|
||||||
for(i=4; i<ELEMENT_COUNT; i++) {
|
for(i=4; i<ELEMENT_COUNT; i++) {
|
||||||
UNIT_TEST_ASSERT(list_contains(lst, &elements[i]) == 0);
|
UNIT_TEST_ASSERT(!list_contains(lst, &elements[i]));
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Remove the tail
|
* Remove the tail
|
||||||
|
|
Loading…
Reference in New Issue