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

@ -216,7 +216,7 @@ static int emit_info(struct impl *this, bool full)
{
int err = 0;
struct spa_dict_item *items;
uint32_t i, n_items;
uint32_t n_items;
const struct acp_dict_item *it;
struct acp_card *card = this->card;
char path[128];
@ -241,10 +241,10 @@ static int emit_info(struct impl *this, bool full)
#undef ADD_ITEM
if (this->info.change_mask & SPA_DEVICE_CHANGE_MASK_PARAMS) {
for (i = 0; i < SPA_N_ELEMENTS(this->params); i++) {
if (this->params[i].user > 0) {
this->params[i].flags ^= SPA_PARAM_INFO_SERIAL;
this->params[i].user = 0;
SPA_FOR_EACH_ELEMENT_VAR(this->params, p) {
if (p->user > 0) {
p->flags ^= SPA_PARAM_INFO_SERIAL;
p->user = 0;
}
}
}