diff --git a/src/ble/gatt_client.c b/src/ble/gatt_client.c index 985c8ee72..6e264b433 100644 --- a/src/ble/gatt_client.c +++ b/src/ble/gatt_client.c @@ -138,7 +138,7 @@ static void gatt_client_timeout_stop(gatt_client_t * peripheral){ static gatt_client_t * get_gatt_client_context_for_handle(uint16_t handle){ btstack_linked_item_t *it; - for (it = (btstack_linked_item_t *) gatt_client_connections; it ; it = it->next){ + for (it = (btstack_linked_item_t *) gatt_client_connections; it != NULL; it = it->next){ gatt_client_t * peripheral = (gatt_client_t *) it; if (peripheral->con_handle == handle){ return peripheral; @@ -1074,7 +1074,7 @@ static int gatt_client_run_for_peripheral( gatt_client_t * peripheral){ static void gatt_client_run(void){ btstack_linked_item_t *it; - for (it = (btstack_linked_item_t *) gatt_client_connections; it ; it = it->next){ + for (it = (btstack_linked_item_t *) gatt_client_connections; it != NULL; it = it->next){ gatt_client_t * peripheral = (gatt_client_t *) it; if (!att_dispatch_client_can_send_now(peripheral->con_handle)) { att_dispatch_client_request_can_send_now_event(peripheral->con_handle); diff --git a/src/btstack_linked_list.c b/src/btstack_linked_list.c index 207078f5b..b6012f28a 100644 --- a/src/btstack_linked_list.c +++ b/src/btstack_linked_list.c @@ -61,7 +61,7 @@ bool btstack_linked_list_empty(btstack_linked_list_t * list){ btstack_linked_item_t * btstack_linked_list_get_last_item(btstack_linked_list_t * list){ // <-- find the last item in the list btstack_linked_item_t *lastItem = NULL; btstack_linked_item_t *it; - for (it = *list; it ; it = it->next){ + for (it = *list; it != NULL; it = it->next){ if (it) { lastItem = it; } @@ -76,7 +76,7 @@ btstack_linked_item_t * btstack_linked_list_get_last_item(btstack_linked_list_t bool btstack_linked_list_add(btstack_linked_list_t * list, btstack_linked_item_t *item){ // <-- add item to list // check if already in list btstack_linked_item_t *it; - for (it = *list; it ; it = it->next){ + for (it = *list; it != NULL; it = it->next){ if (it == item) { return false; } @@ -90,7 +90,7 @@ bool btstack_linked_list_add(btstack_linked_list_t * list, btstack_linked_item_t bool btstack_linked_list_add_tail(btstack_linked_list_t * list, btstack_linked_item_t *item){ // <-- add item to list as last element // check if already in list btstack_linked_item_t *it; - for (it = (btstack_linked_item_t *) list; it->next ; it = it->next){ + for (it = (btstack_linked_item_t *) list; it->next != NULL ; it = it->next){ if (it->next == item) { return false; } @@ -103,7 +103,7 @@ bool btstack_linked_list_add_tail(btstack_linked_list_t * list, btstack_linked_i bool btstack_linked_list_remove(btstack_linked_list_t * list, btstack_linked_item_t *item){ // <-- remove item from list if (!item) return false; btstack_linked_item_t *it; - for (it = (btstack_linked_item_t *) list; it ; it = it->next){ + for (it = (btstack_linked_item_t *) list; it != NULL; it = it->next){ if (it->next == item){ it->next = item->next; return true; @@ -118,7 +118,7 @@ bool btstack_linked_list_remove(btstack_linked_list_t * list, btstack_linked_it int btstack_linked_list_count(btstack_linked_list_t * list){ btstack_linked_item_t *it; int counter = 0; - for (it = (btstack_linked_item_t *) list; it->next ; it = it->next) { + for (it = (btstack_linked_item_t *) list; it->next != NULL; it = it->next) { counter++; } return counter; diff --git a/src/btstack_memory_pool.c b/src/btstack_memory_pool.c index 2f3736770..8d2db9d6a 100644 --- a/src/btstack_memory_pool.c +++ b/src/btstack_memory_pool.c @@ -86,7 +86,7 @@ void btstack_memory_pool_free(btstack_memory_pool_t *pool, void * block){ // raise error and abort if node already in list node_t * it; - for (it = free_blocks->next; it ; it = it->next){ + for (it = free_blocks->next; it != NULL; it = it->next){ if (it == node) { log_error("btstack_memory_pool_free: block %p freed twice for pool %p", block, pool); return; diff --git a/src/hci.c b/src/hci.c index ab84ccc1f..52d01424c 100644 --- a/src/hci.c +++ b/src/hci.c @@ -439,7 +439,7 @@ static int hci_is_le_connection(hci_connection_t * connection){ static int nr_hci_connections(void){ int count = 0; btstack_linked_item_t *it; - for (it = (btstack_linked_item_t *) hci_stack->connections; it ; it = it->next){ + for (it = (btstack_linked_item_t *) hci_stack->connections; it != NULL ; it = it->next){ count++; } return count; @@ -451,7 +451,7 @@ static int hci_number_free_acl_slots_for_connection_type(bd_addr_type_t address_ unsigned int num_packets_sent_le = 0; btstack_linked_item_t *it; - for (it = (btstack_linked_item_t *) hci_stack->connections; it ; it = it->next){ + for (it = (btstack_linked_item_t *) hci_stack->connections; it != NULL; it = it->next){ hci_connection_t * connection = (hci_connection_t *) it; if (hci_is_le_connection(connection)){ num_packets_sent_le += connection->num_packets_sent; @@ -3533,7 +3533,7 @@ static void hci_run(void){ #endif // send pending HCI commands - for (it = (btstack_linked_item_t *) hci_stack->connections; it ; it = it->next){ + for (it = (btstack_linked_item_t *) hci_stack->connections; it != NULL; it = it->next){ hci_connection_t * connection = (hci_connection_t *) it; switch(connection->state){ @@ -4593,7 +4593,7 @@ uint8_t gap_connect(bd_addr_t addr, bd_addr_type_t addr_type){ // @assumption: only a single outgoing LE Connection exists static hci_connection_t * gap_get_outgoing_connection(void){ btstack_linked_item_t *it; - for (it = (btstack_linked_item_t *) hci_stack->connections; it ; it = it->next){ + for (it = (btstack_linked_item_t *) hci_stack->connections; it != NULL; it = it->next){ hci_connection_t * conn = (hci_connection_t *) it; if (!hci_is_le_connection(conn)) continue; switch (conn->state){