list: add list_next() operation

This commit is contained in:
Eduardo Beloni 2011-10-07 10:38:44 -03:00
parent 1a302821ec
commit a512574314
2 changed files with 15 additions and 0 deletions

View File

@ -44,6 +44,7 @@ FREERDP_API void list_free(LIST* list);
FREERDP_API void list_enqueue(LIST* list, void* data);
FREERDP_API void* list_dequeue(LIST* list);
FREERDP_API void* list_peek(LIST* list);
FREERDP_API void* list_next(LIST* list, void* data);
#define list_add(_l, _d) list_enqueue(_l, _d)
FREERDP_API void* list_remove(LIST* list, void* data);
FREERDP_API int list_size(LIST* list);

View File

@ -108,6 +108,20 @@ void* list_peek(LIST* list)
return item ? item->data : NULL;
}
void* list_next(LIST* list, void* data)
{
LIST_ITEM* item;
item = list_item_find(list, data);
data = NULL;
if (item != NULL)
{
if (item->next != NULL)
data = item->next->data;
}
return data;
}
void* list_remove(LIST* list, void* data)
{
LIST_ITEM* item;