[pulseaudio-commits] 4 commits - src/modules src/pulsecore

David Henningsson diwic at kemper.freedesktop.org
Thu May 31 05:30:01 PDT 2012


 src/modules/alsa/alsa-sink.c         |    1 +
 src/modules/alsa/alsa-source.c       |    1 +
 src/modules/module-always-sink.c     |    2 +-
 src/modules/module-card-restore.c    |    2 +-
 src/modules/module-device-manager.c  |    2 +-
 src/modules/module-device-restore.c  |    6 +++---
 src/modules/module-stream-restore.c  |    2 +-
 src/modules/module-suspend-on-idle.c |    4 ++--
 src/pulsecore/card.c                 |    4 ++--
 src/pulsecore/cli-text.c             |   20 ++++++++++----------
 src/pulsecore/core-scache.c          |    4 ++--
 src/pulsecore/module.c               |    2 +-
 src/pulsecore/protocol-native.c      |    2 +-
 13 files changed, 27 insertions(+), 25 deletions(-)

New commits:
commit fdfea553fd77cefe953a1e51afd0b27c8e330d25
Author: Eero Nurkkala <eero.nurkkala at offcode.fi>
Date:   Thu May 31 10:44:23 2012 +0300

    alsa-source: add missing header 'signal.h'
    
    Compilation with -DDEBUG_TIMING fails due to a missing header:
    
    modules/alsa/alsa-source.c: In function 'check_left_to_record':
    modules/alsa/alsa-source.c:426:9: warning: implicit declaration of function 'raise' [-Wimplicit-function-declaration]
    modules/alsa/alsa-source.c:426:9: error: 'SIGTRAP' undeclared (first use in this function)
    
    Signed-off-by: Eero Nurkkala <eero.nurkkala at offcode.fi>

diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c
index 97092bb..dfad817 100644
--- a/src/modules/alsa/alsa-source.c
+++ b/src/modules/alsa/alsa-source.c
@@ -24,6 +24,7 @@
 #include <config.h>
 #endif
 
+#include <signal.h>
 #include <stdio.h>
 
 #include <asoundlib.h>

commit 79c0d52a392bc05c0068958614bd56c744354586
Author: Eero Nurkkala <eero.nurkkala at offcode.fi>
Date:   Thu May 31 10:44:22 2012 +0300

    alsa-sink: add missing header 'signal.h'
    
    Compilation with -DDEBUG_TIMING fails due to a missing header:
    
    modules/alsa/alsa-sink.c: In function 'check_left_to_play':
    modules/alsa/alsa-sink.c:453:9: warning: implicit declaration of function 'raise' [-Wimplicit-function-declaration]
    modules/alsa/alsa-sink.c:453:9: error: 'SIGTRAP' undeclared (first use in this function)
    
    Signed-off-by: Eero Nurkkala <eero.nurkkala at offcode.fi>

diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c
index c3d18e3..1bee8f3 100644
--- a/src/modules/alsa/alsa-sink.c
+++ b/src/modules/alsa/alsa-sink.c
@@ -24,6 +24,7 @@
 #include <config.h>
 #endif
 
+#include <signal.h>
 #include <stdio.h>
 
 #include <asoundlib.h>

commit 13c7a555996c909433aa2b49cc77219154018800
Author: Harsh Prateek Bora <harsh.bora at linaro.org>
Date:   Tue May 29 17:58:12 2012 +0530

    pulsecore: Use PA_IDXSET_FOREACH wherever applicable.
    
    Signed-off-by: Harsh Prateek Bora <harsh.bora at linaro.org>

diff --git a/src/pulsecore/card.c b/src/pulsecore/card.c
index 1f12aef..1d0a9ea 100644
--- a/src/pulsecore/card.c
+++ b/src/pulsecore/card.c
@@ -263,14 +263,14 @@ int pa_card_suspend(pa_card *c, pa_bool_t suspend, pa_suspend_cause_t cause) {
     pa_assert(c);
     pa_assert(cause != 0);
 
-    for (sink = pa_idxset_first(c->sinks, &idx); sink; sink = pa_idxset_next(c->sinks, &idx)) {
+    PA_IDXSET_FOREACH(sink, c->sinks, idx) {
         int r;
 
         if ((r = pa_sink_suspend(sink, suspend, cause)) < 0)
             ret = r;
     }
 
-    for (source = pa_idxset_first(c->sources, &idx); source; source = pa_idxset_next(c->sources, &idx)) {
+    PA_IDXSET_FOREACH(source, c->sources, idx) {
         int r;
 
         if ((r = pa_source_suspend(source, suspend, cause)) < 0)
diff --git a/src/pulsecore/cli-text.c b/src/pulsecore/cli-text.c
index e7bea34..d234b96 100644
--- a/src/pulsecore/cli-text.c
+++ b/src/pulsecore/cli-text.c
@@ -50,7 +50,7 @@ char *pa_module_list_to_string(pa_core *c) {
 
     pa_strbuf_printf(s, "%u module(s) loaded.\n", pa_idxset_size(c->modules));
 
-    for (m = pa_idxset_first(c->modules, &idx); m; m = pa_idxset_next(c->modules, &idx)) {
+    PA_IDXSET_FOREACH(m, c->modules, idx) {
         char *t;
 
         pa_strbuf_printf(s, "    index: %u\n"
@@ -82,7 +82,7 @@ char *pa_client_list_to_string(pa_core *c) {
 
     pa_strbuf_printf(s, "%u client(s) logged in.\n", pa_idxset_size(c->clients));
 
-    for (client = pa_idxset_first(c->clients, &idx); client; client = pa_idxset_next(c->clients, &idx)) {
+    PA_IDXSET_FOREACH(client, c->clients, idx) {
         char *t;
         pa_strbuf_printf(
                 s,
@@ -143,7 +143,7 @@ char *pa_card_list_to_string(pa_core *c) {
 
     pa_strbuf_printf(s, "%u card(s) available.\n", pa_idxset_size(c->cards));
 
-    for (card = pa_idxset_first(c->cards, &idx); card; card = pa_idxset_next(c->cards, &idx)) {
+    PA_IDXSET_FOREACH(card, c->cards, idx) {
         char *t;
         pa_sink *sink;
         pa_source *source;
@@ -182,13 +182,13 @@ char *pa_card_list_to_string(pa_core *c) {
 
         if (!pa_idxset_isempty(card->sinks)) {
             pa_strbuf_puts(s, "\tsinks:\n");
-            for (sink = pa_idxset_first(card->sinks, &sidx); sink; sink = pa_idxset_next(card->sinks, &sidx))
+            PA_IDXSET_FOREACH(sink, card->sinks, sidx)
                 pa_strbuf_printf(s, "\t\t%s/#%u: %s\n", sink->name, sink->index, pa_strna(pa_proplist_gets(sink->proplist, PA_PROP_DEVICE_DESCRIPTION)));
         }
 
         if (!pa_idxset_isempty(card->sources)) {
             pa_strbuf_puts(s, "\tsources:\n");
-            for (source = pa_idxset_first(card->sources, &sidx); source; source = pa_idxset_next(card->sources, &sidx))
+            PA_IDXSET_FOREACH(source, card->sources, sidx)
                 pa_strbuf_printf(s, "\t\t%s/#%u: %s\n", source->name, source->index, pa_strna(pa_proplist_gets(source->proplist, PA_PROP_DEVICE_DESCRIPTION)));
         }
 
@@ -242,7 +242,7 @@ char *pa_sink_list_to_string(pa_core *c) {
 
     pa_strbuf_printf(s, "%u sink(s) available.\n", pa_idxset_size(c->sinks));
 
-    for (sink = pa_idxset_first(c->sinks, &idx); sink; sink = pa_idxset_next(c->sinks, &idx)) {
+    PA_IDXSET_FOREACH(sink, c->sinks, idx) {
         char ss[PA_SAMPLE_SPEC_SNPRINT_MAX],
             cv[PA_CVOLUME_SNPRINT_MAX],
             cvdb[PA_SW_CVOLUME_SNPRINT_DB_MAX],
@@ -361,7 +361,7 @@ char *pa_source_list_to_string(pa_core *c) {
 
     pa_strbuf_printf(s, "%u source(s) available.\n", pa_idxset_size(c->sources));
 
-    for (source = pa_idxset_first(c->sources, &idx); source; source = pa_idxset_next(c->sources, &idx)) {
+    PA_IDXSET_FOREACH(source, c->sources, idx) {
         char ss[PA_SAMPLE_SPEC_SNPRINT_MAX],
             cv[PA_CVOLUME_SNPRINT_MAX],
             cvdb[PA_SW_CVOLUME_SNPRINT_DB_MAX],
@@ -483,7 +483,7 @@ char *pa_source_output_list_to_string(pa_core *c) {
 
     pa_strbuf_printf(s, "%u source outputs(s) available.\n", pa_idxset_size(c->source_outputs));
 
-    for (o = pa_idxset_first(c->source_outputs, &idx); o; o = pa_idxset_next(c->source_outputs, &idx)) {
+    PA_IDXSET_FOREACH(o, c->source_outputs, idx) {
         char ss[PA_SAMPLE_SPEC_SNPRINT_MAX], cvdb[PA_SW_CVOLUME_SNPRINT_DB_MAX], cv[PA_CVOLUME_SNPRINT_MAX], cm[PA_CHANNEL_MAP_SNPRINT_MAX], *t, clt[28];
         pa_usec_t cl;
         const char *cmn;
@@ -582,7 +582,7 @@ char *pa_sink_input_list_to_string(pa_core *c) {
 
     pa_strbuf_printf(s, "%u sink input(s) available.\n", pa_idxset_size(c->sink_inputs));
 
-    for (i = pa_idxset_first(c->sink_inputs, &idx); i; i = pa_idxset_next(c->sink_inputs, &idx)) {
+    PA_IDXSET_FOREACH(i, c->sink_inputs, idx) {
         char ss[PA_SAMPLE_SPEC_SNPRINT_MAX], cvdb[PA_SW_CVOLUME_SNPRINT_DB_MAX], cv[PA_CVOLUME_SNPRINT_MAX], cm[PA_CHANNEL_MAP_SNPRINT_MAX], *t, clt[28];
         pa_usec_t cl;
         const char *cmn;
@@ -673,7 +673,7 @@ char *pa_scache_list_to_string(pa_core *c) {
         pa_scache_entry *e;
         uint32_t idx = PA_IDXSET_INVALID;
 
-        for (e = pa_idxset_first(c->scache, &idx); e; e = pa_idxset_next(c->scache, &idx)) {
+        PA_IDXSET_FOREACH(e, c->scache, idx) {
             double l = 0;
             char ss[PA_SAMPLE_SPEC_SNPRINT_MAX] = "n/a", cv[PA_CVOLUME_SNPRINT_MAX], cvdb[PA_SW_CVOLUME_SNPRINT_DB_MAX], cm[PA_CHANNEL_MAP_SNPRINT_MAX] = "n/a", *t;
             const char *cmn;
diff --git a/src/pulsecore/core-scache.c b/src/pulsecore/core-scache.c
index 4f2a44d..73f65d2 100644
--- a/src/pulsecore/core-scache.c
+++ b/src/pulsecore/core-scache.c
@@ -416,7 +416,7 @@ size_t pa_scache_total_size(pa_core *c) {
     if (!c->scache || !pa_idxset_size(c->scache))
         return 0;
 
-    for (e = pa_idxset_first(c->scache, &idx); e; e = pa_idxset_next(c->scache, &idx))
+    PA_IDXSET_FOREACH(e, c->scache, idx)
         if (e->memchunk.memblock)
             sum += e->memchunk.length;
 
@@ -435,7 +435,7 @@ void pa_scache_unload_unused(pa_core *c) {
 
     time(&now);
 
-    for (e = pa_idxset_first(c->scache, &idx); e; e = pa_idxset_next(c->scache, &idx)) {
+    PA_IDXSET_FOREACH(e, c->scache, idx) {
 
         if (!e->lazy || !e->memchunk.memblock)
             continue;
diff --git a/src/pulsecore/module.c b/src/pulsecore/module.c
index 8b3ff8f..5eb3572 100644
--- a/src/pulsecore/module.c
+++ b/src/pulsecore/module.c
@@ -79,7 +79,7 @@ pa_module* pa_module_load(pa_core *c, const char *name, const char *argument) {
             uint32_t idx;
             /* OK, the module only wants to be loaded once, let's make sure it is */
 
-            for (i = pa_idxset_first(c->modules, &idx); i; i = pa_idxset_next(c->modules, &idx)) {
+            PA_IDXSET_FOREACH(i, c->modules, idx) {
                 if (strcmp(name, i->name) == 0) {
                     pa_log("Module \"%s\" should be loaded once at most. Refusing to load.", name);
                     goto fail;
diff --git a/src/pulsecore/protocol-native.c b/src/pulsecore/protocol-native.c
index b0fc8c8..a698f74 100644
--- a/src/pulsecore/protocol-native.c
+++ b/src/pulsecore/protocol-native.c
@@ -3558,7 +3558,7 @@ static void command_get_info_list(pa_pdispatch *pd, uint32_t command, uint32_t t
     }
 
     if (i) {
-        for (p = pa_idxset_first(i, &idx); p; p = pa_idxset_next(i, &idx)) {
+        PA_IDXSET_FOREACH(p, i, idx) {
             if (command == PA_COMMAND_GET_SINK_INFO_LIST)
                 sink_fill_tagstruct(c, reply, p);
             else if (command == PA_COMMAND_GET_SOURCE_INFO_LIST)

commit f38c1e9bf950f3a28ab23b3c2337d4981ec2cc42
Author: Harsh Prateek Bora <harsh.bora at linaro.org>
Date:   Tue May 29 17:58:11 2012 +0530

    modules: Use PA_IDXSET_FOREACH wherever applicable.
    
    Signed-off-by: Harsh Prateek Bora <harsh.bora at linaro.org>

diff --git a/src/modules/module-always-sink.c b/src/modules/module-always-sink.c
index 5d9ee63..0df4890 100644
--- a/src/modules/module-always-sink.c
+++ b/src/modules/module-always-sink.c
@@ -67,7 +67,7 @@ static void load_null_sink_if_needed(pa_core *c, pa_sink *sink, struct userdata*
 
     /* Loop through all sinks and check to see if we have *any*
      * sinks. Ignore the sink passed in (if it's not null) */
-    for (target = pa_idxset_first(c->sinks, &idx); target; target = pa_idxset_next(c->sinks, &idx))
+    PA_IDXSET_FOREACH(target, c->sinks, idx)
         if (!sink || target != sink)
             break;
 
diff --git a/src/modules/module-card-restore.c b/src/modules/module-card-restore.c
index f987f19..e90e610 100644
--- a/src/modules/module-card-restore.c
+++ b/src/modules/module-card-restore.c
@@ -328,7 +328,7 @@ int pa__init(pa_module*m) {
     pa_log_info("Successfully opened database file '%s'.", fname);
     pa_xfree(fname);
 
-    for (card = pa_idxset_first(m->core->cards, &idx); card; card = pa_idxset_next(m->core->cards, &idx))
+    PA_IDXSET_FOREACH(card, m->core->cards, idx)
         subscribe_callback(m->core, PA_SUBSCRIPTION_EVENT_CARD|PA_SUBSCRIPTION_EVENT_NEW, card->index, u);
 
     pa_modargs_free(ma);
diff --git a/src/modules/module-device-manager.c b/src/modules/module-device-manager.c
index e11921d..fe48d4f 100644
--- a/src/modules/module-device-manager.c
+++ b/src/modules/module-device-manager.c
@@ -435,7 +435,7 @@ static void notify_subscribers(struct userdata *u) {
 
     pa_assert(u);
 
-    for (c = pa_idxset_first(u->subscribed, &idx); c; c = pa_idxset_next(u->subscribed, &idx)) {
+    PA_IDXSET_FOREACH(c, u->subscribed, idx) {
         pa_tagstruct *t;
 
         t = pa_tagstruct_new(NULL, 0);
diff --git a/src/modules/module-device-restore.c b/src/modules/module-device-restore.c
index de98035..b9bd498 100644
--- a/src/modules/module-device-restore.c
+++ b/src/modules/module-device-restore.c
@@ -151,7 +151,7 @@ static void trigger_save(struct userdata *u, pa_device_type_t type, uint32_t sin
     uint32_t idx;
 
     if (sink_idx != PA_INVALID_INDEX) {
-        for (c = pa_idxset_first(u->subscribed, &idx); c; c = pa_idxset_next(u->subscribed, &idx)) {
+        PA_IDXSET_FOREACH(c, u->subscribed, idx) {
             pa_tagstruct *t;
 
             t = pa_tagstruct_new(NULL, 0);
@@ -1275,10 +1275,10 @@ int pa__init(pa_module*m) {
     pa_log_info("Successfully opened database file '%s'.", fname);
     pa_xfree(fname);
 
-    for (sink = pa_idxset_first(m->core->sinks, &idx); sink; sink = pa_idxset_next(m->core->sinks, &idx))
+    PA_IDXSET_FOREACH(sink, m->core->sinks, idx)
         subscribe_callback(m->core, PA_SUBSCRIPTION_EVENT_SINK|PA_SUBSCRIPTION_EVENT_NEW, sink->index, u);
 
-    for (source = pa_idxset_first(m->core->sources, &idx); source; source = pa_idxset_next(m->core->sources, &idx))
+    PA_IDXSET_FOREACH(source, m->core->sources, idx)
         subscribe_callback(m->core, PA_SUBSCRIPTION_EVENT_SOURCE|PA_SUBSCRIPTION_EVENT_NEW, source->index, u);
 
     pa_modargs_free(ma);
diff --git a/src/modules/module-stream-restore.c b/src/modules/module-stream-restore.c
index 23889ca..228f902 100644
--- a/src/modules/module-stream-restore.c
+++ b/src/modules/module-stream-restore.c
@@ -1201,7 +1201,7 @@ static void trigger_save(struct userdata *u) {
     pa_native_connection *c;
     uint32_t idx;
 
-    for (c = pa_idxset_first(u->subscribed, &idx); c; c = pa_idxset_next(u->subscribed, &idx)) {
+    PA_IDXSET_FOREACH(c, u->subscribed, idx) {
         pa_tagstruct *t;
 
         t = pa_tagstruct_new(NULL, 0);
diff --git a/src/modules/module-suspend-on-idle.c b/src/modules/module-suspend-on-idle.c
index 07d937c..e1f6043 100644
--- a/src/modules/module-suspend-on-idle.c
+++ b/src/modules/module-suspend-on-idle.c
@@ -439,10 +439,10 @@ int pa__init(pa_module*m) {
     u->timeout = timeout;
     u->device_infos = pa_hashmap_new(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func);
 
-    for (sink = pa_idxset_first(m->core->sinks, &idx); sink; sink = pa_idxset_next(m->core->sinks, &idx))
+    PA_IDXSET_FOREACH(sink, m->core->sinks, idx)
         device_new_hook_cb(m->core, PA_OBJECT(sink), u);
 
-    for (source = pa_idxset_first(m->core->sources, &idx); source; source = pa_idxset_next(m->core->sources, &idx))
+    PA_IDXSET_FOREACH(source, m->core->sources, idx)
         device_new_hook_cb(m->core, PA_OBJECT(source), u);
 
     u->sink_new_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SINK_PUT], PA_HOOK_NORMAL, (pa_hook_cb_t) device_new_hook_cb, u);



More information about the pulseaudio-commits mailing list