mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
spa: add macro to simplify array iterations some more
uint32_t i; for (i = 0; i < SPA_N_ELEMENTS(some_array); i++) .. stuff with some_array[i].foo ... becomes: SPA_FOR_EACH_ELEMENT_VAR(some_array, p) .. stuff with p->foo ..
This commit is contained in:
parent
365ebcda9b
commit
d22feab92a
21 changed files with 113 additions and 150 deletions
|
|
@ -98,13 +98,11 @@ static struct mix_info mix_table[] =
|
|||
static const struct mix_info *find_mix_info(uint32_t fmt,
|
||||
uint32_t n_channels, uint32_t cpu_flags)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < SPA_N_ELEMENTS(mix_table); i++) {
|
||||
if (mix_table[i].fmt == fmt &&
|
||||
MATCH_CHAN(mix_table[i].n_channels, n_channels) &&
|
||||
MATCH_CPU_FLAGS(mix_table[i].cpu_flags, cpu_flags))
|
||||
return &mix_table[i];
|
||||
SPA_FOR_EACH_ELEMENT_VAR(mix_table, t) {
|
||||
if (t->fmt == fmt &&
|
||||
MATCH_CHAN(t->n_channels, n_channels) &&
|
||||
MATCH_CPU_FLAGS(t->cpu_flags, cpu_flags))
|
||||
return t;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue