[pulseaudio-discuss] [PATCH 2/2] Use simple free function in pa_queue_free

Maarten Bosmans mkbosmans at gmail.com
Fri Nov 18 00:58:09 PST 2011


---
 src/pulsecore/pstream.c |    8 ++++----
 src/pulsecore/queue.c   |    4 ++--
 src/pulsecore/queue.h   |    4 ++--
 src/pulsecore/sink.c    |    4 ++--
 src/pulsecore/source.c  |    4 ++--
 src/tests/queue-test.c  |    2 +-
 6 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/pulsecore/pstream.c b/src/pulsecore/pstream.c
index 3e59fc4..b06c77a 100644
--- a/src/pulsecore/pstream.c
+++ b/src/pulsecore/pstream.c
@@ -276,7 +276,7 @@ pa_pstream *pa_pstream_new(pa_mainloop_api *m, pa_iochannel *io, pa_mempool *poo
     return p;
 }
 
-static void item_free(void *item, void *q) {
+static void item_free(void *item) {
     struct item_info *i = item;
     pa_assert(i);
 
@@ -297,10 +297,10 @@ static void pstream_free(pa_pstream *p) {
 
     pa_pstream_unlink(p);
 
-    pa_queue_free(p->send_queue, item_free, NULL);
+    pa_queue_free(p->send_queue, item_free);
 
     if (p->write.current)
-        item_free(p->write.current, NULL);
+        item_free(p->write.current);
 
     if (p->write.memchunk.memblock)
         pa_memblock_unref(p->write.memchunk.memblock);
@@ -604,7 +604,7 @@ static int do_write(pa_pstream *p) {
 
     if (p->write.index >= PA_PSTREAM_DESCRIPTOR_SIZE + ntohl(p->write.descriptor[PA_PSTREAM_DESCRIPTOR_LENGTH])) {
         pa_assert(p->write.current);
-        item_free(p->write.current, NULL);
+        item_free(p->write.current);
         p->write.current = NULL;
 
         if (p->write.memchunk.memblock)
diff --git a/src/pulsecore/queue.c b/src/pulsecore/queue.c
index 2c73a3d..f4216ee 100644
--- a/src/pulsecore/queue.c
+++ b/src/pulsecore/queue.c
@@ -52,13 +52,13 @@ pa_queue* pa_queue_new(void) {
     return q;
 }
 
-void pa_queue_free(pa_queue* q, pa_free2_cb_t free_func, void *userdata) {
+void pa_queue_free(pa_queue *q, pa_free_cb_t free_func) {
     void *data;
     pa_assert(q);
 
     while ((data = pa_queue_pop(q)))
         if (free_func)
-            free_func(data, userdata);
+            free_func(data);
 
     pa_assert(!q->front);
     pa_assert(!q->back);
diff --git a/src/pulsecore/queue.h b/src/pulsecore/queue.h
index f3cec9b..1b95ec8 100644
--- a/src/pulsecore/queue.h
+++ b/src/pulsecore/queue.h
@@ -22,7 +22,7 @@
   USA.
 ***/
 
-#include <pulsecore/idxset.h>
+#include <pulse/def.h>
 
 typedef struct pa_queue pa_queue;
 
@@ -33,7 +33,7 @@ pa_queue* pa_queue_new(void);
 
 /* Free the queue and run the specified callback function for every
  * remaining entry. The callback function may be NULL. */
-void pa_queue_free(pa_queue* q, pa_free2_cb_t free_func, void *userdata);
+void pa_queue_free(pa_queue *q, pa_free_cb_t free_func);
 
 void pa_queue_push(pa_queue *q, void *p);
 void* pa_queue_pop(pa_queue *q);
diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c
index aa7661a..0e54561 100644
--- a/src/pulsecore/sink.c
+++ b/src/pulsecore/sink.c
@@ -895,7 +895,7 @@ void pa_sink_move_all_finish(pa_sink *s, pa_queue *q, pa_bool_t save) {
         pa_sink_input_unref(i);
     }
 
-    pa_queue_free(q, NULL, NULL);
+    pa_queue_free(q, NULL);
 }
 
 /* Called from main context */
@@ -910,7 +910,7 @@ void pa_sink_move_all_fail(pa_queue *q) {
         pa_sink_input_unref(i);
     }
 
-    pa_queue_free(q, NULL, NULL);
+    pa_queue_free(q, NULL);
 }
 
 /* Called from IO thread context */
diff --git a/src/pulsecore/source.c b/src/pulsecore/source.c
index 0ecaa4c..1e827bc 100644
--- a/src/pulsecore/source.c
+++ b/src/pulsecore/source.c
@@ -812,7 +812,7 @@ void pa_source_move_all_finish(pa_source *s, pa_queue *q, pa_bool_t save) {
         pa_source_output_unref(o);
     }
 
-    pa_queue_free(q, NULL, NULL);
+    pa_queue_free(q, NULL);
 }
 
 /* Called from main context */
@@ -827,7 +827,7 @@ void pa_source_move_all_fail(pa_queue *q) {
         pa_source_output_unref(o);
     }
 
-    pa_queue_free(q, NULL, NULL);
+    pa_queue_free(q, NULL);
 }
 
 /* Called from IO thread context */
diff --git a/src/tests/queue-test.c b/src/tests/queue-test.c
index b21775e..6b3e895 100644
--- a/src/tests/queue-test.c
+++ b/src/tests/queue-test.c
@@ -58,7 +58,7 @@ int main(int argc, char *argv[]) {
     pa_queue_push(q, (void*) "sechs");
     pa_queue_push(q, (void*) "sieben");
 
-    pa_queue_free(q, NULL, NULL);
+    pa_queue_free(q, NULL);
 
     return 0;
 }
-- 
1.7.4.1



More information about the pulseaudio-discuss mailing list