Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0d4e3999 authored by Takashi Sakamoto's avatar Takashi Sakamoto Committed by Takashi Iwai
Browse files

ALSA: pcm: use goto statement instead of while statement to reduce indentation



In a process to calculate parameters of PCM substream, application of all
rules is iterated several times till parameter dependencies are satisfied.
In current implementation, two loops are used for the design, however this
brings two-level indentation and decline readability.

This commit attempts to reduce the indentation by using goto statement,
instead of outer while loop.

Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 9cc07f55
Loading
Loading
Loading
Loading
+44 −42
Original line number Diff line number Diff line
@@ -337,7 +337,7 @@ static int constrain_params_by_rules(struct snd_pcm_substream *substream,
		rstamps[k] = 0;
	for (k = 0; k <= SNDRV_PCM_HW_PARAM_LAST_INTERVAL; k++)
		vstamps[k] = (params->rmask & (1 << k)) ? 1 : 0;
	do {
retry:
	again = 0;
	for (k = 0; k < constrs->rules_num; k++) {
		struct snd_pcm_hw_rule *r = &constrs->rules[k];
@@ -384,7 +384,9 @@ static int constrain_params_by_rules(struct snd_pcm_substream *substream,
			return changed;
		stamp++;
	}
	} while (again);

	if (again)
		goto retry;

	return 0;
}