summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTanu Kaskinen <tanuk@iki.fi>2016-03-04 15:23:29 +0200
committerArun Raghavan <git@arunraghavan.net>2016-05-03 09:18:28 +0530
commitb88f2859a988ce5a1667363445c67fc34b756298 (patch)
treea928b092a36b5580b6dae6c417dd6e0019437607
parenta99eb81db363427d706ee28db73dd33999291cf3 (diff)
downloadpulseaudio-b88f2859a988ce5a1667363445c67fc34b756298.tar.gz
switch-on-port-available: avoid repetitive pointer deferencing
Trivial refactoring.
-rw-r--r--src/modules/module-switch-on-port-available.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/modules/module-switch-on-port-available.c b/src/modules/module-switch-on-port-available.c
index 9bfb43f34..2453644c9 100644
--- a/src/modules/module-switch-on-port-available.c
+++ b/src/modules/module-switch-on-port-available.c
@@ -30,22 +30,25 @@
#include "module-switch-on-port-available-symdef.h"
static bool profile_good_for_output(pa_card_profile *profile, unsigned prio) {
+ pa_card *card;
pa_sink *sink;
uint32_t idx;
pa_assert(profile);
- if (!pa_safe_streq(profile->card->active_profile->input_name, profile->input_name))
+ card = profile->card;
+
+ if (!pa_safe_streq(card->active_profile->input_name, profile->input_name))
return false;
- if (profile->card->active_profile->n_sources != profile->n_sources)
+ if (card->active_profile->n_sources != profile->n_sources)
return false;
- if (profile->card->active_profile->max_source_channels != profile->max_source_channels)
+ if (card->active_profile->max_source_channels != profile->max_source_channels)
return false;
/* Try not to switch to HDMI sinks from analog when HDMI is becoming available */
- PA_IDXSET_FOREACH(sink, profile->card->sinks, idx) {
+ PA_IDXSET_FOREACH(sink, card->sinks, idx) {
if (!sink->active_port)
continue;
@@ -57,21 +60,24 @@ static bool profile_good_for_output(pa_card_profile *profile, unsigned prio) {
}
static bool profile_good_for_input(pa_card_profile *profile, unsigned prio) {
+ pa_card *card;
pa_source *source;
uint32_t idx;
pa_assert(profile);
- if (!pa_safe_streq(profile->card->active_profile->output_name, profile->output_name))
+ card = profile->card;
+
+ if (!pa_safe_streq(card->active_profile->output_name, profile->output_name))
return false;
- if (profile->card->active_profile->n_sinks != profile->n_sinks)
+ if (card->active_profile->n_sinks != profile->n_sinks)
return false;
- if (profile->card->active_profile->max_sink_channels != profile->max_sink_channels)
+ if (card->active_profile->max_sink_channels != profile->max_sink_channels)
return false;
- PA_IDXSET_FOREACH(source, profile->card->sources, idx) {
+ PA_IDXSET_FOREACH(source, card->sources, idx) {
if (!source->active_port)
continue;