[pulseaudio-discuss] [PATCH 1/2] modules: Use PA_IDXSET_FOREACH wherever applicable.
Harsh Prateek Bora
harsh.bora at linaro.org
Tue May 29 05:28:11 PDT 2012
Signed-off-by: Harsh Prateek Bora <harsh.bora at linaro.org>
---
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 ++--
6 files changed, 9 insertions(+), 9 deletions(-)
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);
--
1.7.5.4
More information about the pulseaudio-discuss
mailing list