mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-10-29 05:40:23 -04:00
idxset: implement pa_idxset_copy()
This commit is contained in:
parent
0b479ffbba
commit
277e8c5ce4
2 changed files with 17 additions and 0 deletions
|
|
@ -453,3 +453,17 @@ pa_bool_t pa_idxset_isempty(pa_idxset *s) {
|
||||||
|
|
||||||
return s->n_entries == 0;
|
return s->n_entries == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pa_idxset *pa_idxset_copy(pa_idxset *s) {
|
||||||
|
pa_idxset *copy;
|
||||||
|
struct idxset_entry *i;
|
||||||
|
|
||||||
|
pa_assert(s);
|
||||||
|
|
||||||
|
copy = pa_idxset_new(s->hash_func, s->compare_func);
|
||||||
|
|
||||||
|
for (i = s->iterate_list_head; i; i = i->iterate_next)
|
||||||
|
pa_idxset_put(copy, i->data, NULL);
|
||||||
|
|
||||||
|
return copy;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -103,6 +103,9 @@ unsigned pa_idxset_size(pa_idxset*s);
|
||||||
/* Return TRUE of the idxset is empty */
|
/* Return TRUE of the idxset is empty */
|
||||||
pa_bool_t pa_idxset_isempty(pa_idxset *s);
|
pa_bool_t pa_idxset_isempty(pa_idxset *s);
|
||||||
|
|
||||||
|
/* Duplicate the idxset. This will not copy the actual indexes */
|
||||||
|
pa_idxset *pa_idxset_copy(pa_idxset *s);
|
||||||
|
|
||||||
/* A macro to ease iteration through all entries */
|
/* A macro to ease iteration through all entries */
|
||||||
#define PA_IDXSET_FOREACH(e, s, idx) \
|
#define PA_IDXSET_FOREACH(e, s, idx) \
|
||||||
for ((e) = pa_idxset_first((s), &(idx)); (e); (e) = pa_idxset_next((s), &(idx)))
|
for ((e) = pa_idxset_first((s), &(idx)); (e); (e) = pa_idxset_next((s), &(idx)))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue