Add pa_channels_valid()

I think this makes the code a bit nicer to read and write. This also
reduces the chances of off-by-one errors when checking the bounds of
channel count values.
This commit is contained in:
Tanu Kaskinen 2013-12-04 09:50:11 +02:00 committed by Peter Meerwald
parent a67318f8af
commit 2747c96101
12 changed files with 24 additions and 22 deletions

View file

@ -2463,7 +2463,7 @@ int pa__init(pa_module *m) {
channels = u->sample_spec.channels;
if (pa_modargs_get_value_u32(ma, "channels", &channels) < 0 ||
channels <= 0 || channels > PA_CHANNELS_MAX) {
!pa_channels_valid(channels)) {
pa_log_error("Failed to get channels from module arguments");
goto fail;
}