From b24546bedee168778a7aef11200dfb0378dfae43 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 15 Jun 2004 17:05:03 +0000 Subject: cleanup git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@18 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/idxset.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'src/idxset.c') diff --git a/src/idxset.c b/src/idxset.c index 4442190d..ea609f60 100644 --- a/src/idxset.c +++ b/src/idxset.c @@ -291,9 +291,7 @@ void* idxset_rrobin(struct idxset *s, uint32_t *index) { if (!e) return NULL; - if (index) - *index = e->index; - + *index = e->index; return e->data; } @@ -308,6 +306,22 @@ void* idxset_first(struct idxset *s, uint32_t *index) { return s->iterate_list_head->data; } +void *idxset_next(struct idxset *s, uint32_t *index) { + struct idxset_entry **a, *e = NULL; + assert(s && index); + + if ((a = array_index(s, *index)) && *a) + e = (*a)->iterate_next; + + if (e) { + *index = e->index; + return e->data; + } else { + *index = IDXSET_INVALID; + return NULL; + } +} + int idxset_foreach(struct idxset*s, int (*func)(void *p, uint32_t index, int *del, void*userdata), void *userdata) { struct idxset_entry *e; @@ -341,3 +355,4 @@ int idxset_isempty(struct idxset *s) { assert(s); return s->n_entries == 0; } + -- cgit