mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-04 13:29:59 -05:00
pulsecore: Use PA_IDXSET_FOREACH wherever applicable.
Signed-off-by: Harsh Prateek Bora <harsh.bora@linaro.org>
This commit is contained in:
parent
f38c1e9bf9
commit
13c7a55599
5 changed files with 16 additions and 16 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue