linked_list: use bool return type

This commit is contained in:
Matthias Ringwald 2019-11-27 17:52:57 +01:00
parent 1c4468cf9f
commit 8b2bf72f1c
2 changed files with 6 additions and 4 deletions

View File

@ -51,7 +51,7 @@
/**
* tests if list is empty
*/
int btstack_linked_list_empty(btstack_linked_list_t * list){
bool btstack_linked_list_empty(btstack_linked_list_t * list){
return *list == (void *) 0;
}
@ -146,7 +146,7 @@ void btstack_linked_list_iterator_init(btstack_linked_list_iterator_t * it, btst
it->curr = * head;
}
int btstack_linked_list_iterator_has_next(btstack_linked_list_iterator_t * it){
bool btstack_linked_list_iterator_has_next(btstack_linked_list_iterator_t * it){
// log_info("btstack_linked_list_iterator_has_next: advance on next %u, it->prev %p, it->curr %p", it->advance_on_next, it->prev, it->curr);
if (!it->advance_on_next){
return it->curr != NULL;

View File

@ -42,6 +42,8 @@
#ifndef BTSTACK_LINKED_LIST_H
#define BTSTACK_LINKED_LIST_H
#include "btstack_bool.h"
#if defined __cplusplus
extern "C" {
#endif
@ -66,7 +68,7 @@ typedef struct {
* @param list
* @returns true if list is empty
*/
int btstack_linked_list_empty(btstack_linked_list_t * list);
bool btstack_linked_list_empty(btstack_linked_list_t * list);
/**
* @brief Add item to list as first element.
@ -132,7 +134,7 @@ void btstack_linked_list_iterator_init(btstack_linked_list_iterator_t * it, btst
* @param it iterator context
* @returns true if next element is available
*/
int btstack_linked_list_iterator_has_next(btstack_linked_list_iterator_t * it);
bool btstack_linked_list_iterator_has_next(btstack_linked_list_iterator_t * it);
/**
* @brief Get next list eleemnt