From 6a38fc08d94556128e35acfcf05507f73c2fa6e4 Mon Sep 17 00:00:00 2001 From: "matthias.ringwald" Date: Thu, 29 Jul 2010 19:46:12 +0000 Subject: [PATCH] added linked_list_empty --- include/btstack/linked_list.h | 1 + src/linked_list.c | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/include/btstack/linked_list.h b/include/btstack/linked_list.h index ed9fcc2d2..8ee711d45 100644 --- a/include/btstack/linked_list.h +++ b/include/btstack/linked_list.h @@ -46,6 +46,7 @@ typedef linked_item_t * linked_list_t; void linked_item_set_user(linked_item_t *item, void *user_data); // <-- set user data void * linked_item_get_user(linked_item_t *item); // <-- get user data +int linked_list_empty(linked_list_t * list); void linked_list_add(linked_list_t * list, linked_item_t *item); // <-- add item to list as first element void linked_list_add_tail(linked_list_t * list, linked_item_t *item); // <-- add item to list as last element int linked_list_remove(linked_list_t * list, linked_item_t *item); // <-- remove item from list diff --git a/src/linked_list.c b/src/linked_list.c index ebea3ce3d..d08774a25 100644 --- a/src/linked_list.c +++ b/src/linked_list.c @@ -37,6 +37,13 @@ #include +/** + * tests if list is empty + */ +int linked_list_empty(linked_list_t * list){ + return *list == (void *) 0; +} + /** * linked_list_add */