Add pa_sample_format_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
the sample format value.
This commit is contained in:
Tanu Kaskinen 2013-12-04 09:50:09 +02:00 committed by Peter Meerwald
parent 643eb5bae2
commit 1cda717252
8 changed files with 30 additions and 45 deletions

View file

@ -650,15 +650,13 @@ size_t pa_mix(
}
pa_do_mix_func_t pa_get_mix_func(pa_sample_format_t f) {
pa_assert(f >= 0);
pa_assert(f < PA_SAMPLE_MAX);
pa_assert(pa_sample_format_valid(f));
return do_mix_table[f];
}
void pa_set_mix_func(pa_sample_format_t f, pa_do_mix_func_t func) {
pa_assert(f >= 0);
pa_assert(f < PA_SAMPLE_MAX);
pa_assert(pa_sample_format_valid(f));
do_mix_table[f] = func;
}