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:
Wim Taymans 2022-09-30 16:21:28 +02:00
parent 365ebcda9b
commit d22feab92a
21 changed files with 113 additions and 150 deletions

View file

@ -56,11 +56,9 @@ static const struct volume_info {
static const struct volume_info *find_volume_info(uint32_t cpu_flags)
{
size_t i;
for (i = 0; i < SPA_N_ELEMENTS(volume_table); i++) {
if (!MATCH_CPU_FLAGS(volume_table[i].cpu_flags, cpu_flags))
continue;
return &volume_table[i];
SPA_FOR_EACH_ELEMENT_VAR(volume_table, t) {
if (MATCH_CPU_FLAGS(t->cpu_flags, cpu_flags))
return t;
}
return NULL;
}