idxset: Allow deep copying with pa_idxset_copy()

This commit is contained in:
Tanu Kaskinen 2013-11-17 22:47:59 +02:00
parent 5c860fe06d
commit d1fd31d50f
4 changed files with 9 additions and 13 deletions

View file

@ -458,7 +458,7 @@ bool pa_idxset_isempty(pa_idxset *s) {
return s->n_entries == 0;
}
pa_idxset *pa_idxset_copy(pa_idxset *s) {
pa_idxset *pa_idxset_copy(pa_idxset *s, pa_copy_func_t copy_func) {
pa_idxset *copy;
struct idxset_entry *i;
@ -467,7 +467,7 @@ pa_idxset *pa_idxset_copy(pa_idxset *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);
pa_idxset_put(copy, copy_func ? copy_func(i->data) : i->data, NULL);
return copy;
}