diff options
author | Benjamin Franzke <benjaminfranzke@googlemail.com> | 2011-12-13 11:29:11 +0100 |
---|---|---|
committer | Benjamin Franzke <benjaminfranzke@googlemail.com> | 2011-12-13 16:30:37 +0100 |
commit | caf68ab21e373594866ef2b26736d3ae02ac6659 (patch) | |
tree | 012f32148fefd64d057926aa09ab19cf331873f7 /src/pa-sink-ctl.c | |
parent | eb6b66cde77a03e0a42999fdf6d5abdb9c373ca6 (diff) | |
download | pa-sink-ctl-caf68ab21e373594866ef2b26736d3ae02ac6659.tar.gz pa-sink-ctl-caf68ab21e373594866ef2b26736d3ae02ac6659.tar.bz2 pa-sink-ctl-caf68ab21e373594866ef2b26736d3ae02ac6659.zip |
Add a list_foreach makro for GList
Saves around 1-2 lines per foreach, and should be more error prone.
Diffstat (limited to 'src/pa-sink-ctl.c')
-rw-r--r-- | src/pa-sink-ctl.c | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/src/pa-sink-ctl.c b/src/pa-sink-ctl.c index 24c9d6c..3b0a827 100644 --- a/src/pa-sink-ctl.c +++ b/src/pa-sink-ctl.c @@ -29,13 +29,11 @@ static struct sink_input_info * find_sink_input_by_idx(struct context *ctx, gint idx) { - GList *l; + struct sink_input_info *input; - for (l = ctx->input_list; l; l = l->next) { - struct sink_input_info *input = l->data; + list_foreach(ctx->input_list, input) if (input->index == idx) return input; - } return NULL; } @@ -43,13 +41,11 @@ find_sink_input_by_idx(struct context *ctx, gint idx) static struct sink_info * find_sink_by_idx(struct context *ctx, gint idx) { - GList *l; + struct sink_info *sink; - for (l = ctx->sink_list; l; l = l->next) { - struct sink_info *sink = l->data; + list_foreach(ctx->sink_list, sink) if (sink->index == idx) return sink; - } return NULL; } @@ -99,12 +95,10 @@ sink_input_info_cb(pa_context *c, const pa_sink_input_info *i, static int get_sink_priority(struct context *ctx, const pa_sink_info *sink_info) { - GList *l; + struct priority *p; const char *value; - for (l = ctx->config.priorities; l; l = l->next) { - struct priority *p = l->data; - + list_foreach(ctx->config.priorities, p) { value = pa_proplist_gets(sink_info->proplist, p->match); if (g_strcmp0(value, p->value) == 0) |