idxset: Add pa_idxset_filtered_copy function to copy existing idxset with a condition 00/169100/6
authorSangchul Lee <sc11.lee@samsung.com>
Thu, 23 Feb 2017 02:01:08 +0000 (11:01 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Fri, 9 Feb 2018 06:43:23 +0000 (06:43 +0000)
same as patch below
 : 6bf96c1b89d149e62a02bb2c2cc233c18e82889d - sc11.lee@samsung.com - 2017-02-23

[Version] 11.1-8
[Issue Type] feature

Change-Id: I31adcc84aaaca5ea29f35e3c7f194dd6399746f7
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
packaging/pulseaudio.spec
src/pulsecore/idxset.c
src/pulsecore/idxset.h

index 35a8f35..956ff48 100644 (file)
@@ -3,7 +3,7 @@
 Name:             pulseaudio
 Summary:          Improved Linux sound server
 Version:          11.1
-Release:          7
+Release:          8
 Group:            Multimedia/Audio
 License:          LGPL-2.1
 URL:              http://pulseaudio.org
index 5175ca2..aa5453e 100644 (file)
@@ -469,3 +469,24 @@ pa_idxset *pa_idxset_copy(pa_idxset *s, pa_copy_func_t copy_func) {
 
     return copy;
 }
+
+#ifdef __TIZEN__
+pa_idxset *pa_idxset_filtered_copy(pa_idxset *s, pa_copy_func_t copy_func, pa_compare_func_t filter_func, const void *filter) {
+    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) {
+        if (filter_func) {
+            if (filter_func(i->data, filter))
+                pa_idxset_put(copy, copy_func ? copy_func(i->data) : i->data, NULL);
+        } else
+            pa_idxset_put(copy, copy_func ? copy_func(i->data) : i->data, NULL);
+    }
+
+    return copy;
+}
+#endif
\ No newline at end of file
index 7acb202..2187b28 100644 (file)
@@ -109,6 +109,11 @@ bool pa_idxset_isempty(pa_idxset *s);
  * copy will be made. */
 pa_idxset *pa_idxset_copy(pa_idxset *s, pa_copy_func_t copy_func);
 
+#ifdef __TIZEN__
+/* Similar to pa_idxset_copy(), but with a filter that can choose the entry to be copied */
+pa_idxset* pa_idxset_filtered_copy(pa_idxset *s, pa_copy_func_t copy_func, pa_compare_func_t filter_func, const void *filter);
+#endif
+
 /* A macro to ease iteration through all entries */
 #define PA_IDXSET_FOREACH(e, s, idx) \
     for ((e) = pa_idxset_first((s), &(idx)); (e); (e) = pa_idxset_next((s), &(idx)))