diff options
author | Lennart Poettering <lennart@poettering.net> | 2004-06-15 17:05:03 +0000 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2004-06-15 17:05:03 +0000 |
commit | b24546bedee168778a7aef11200dfb0378dfae43 (patch) | |
tree | 8fc0c27f32ff7b3c3cfd517ca724444c3e59904d /src/idxset.c | |
parent | 78f386ad45dc046d673fca5441dff188a7297059 (diff) |
cleanup
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@18 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'src/idxset.c')
-rw-r--r-- | src/idxset.c | 21 |
1 files changed, 18 insertions, 3 deletions
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; } + |