mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-04 13:30:12 -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
|
|
@ -37,12 +37,9 @@ static const struct extension extensions[] = {
|
|||
|
||||
const struct extension *extension_find(uint32_t index, const char *name)
|
||||
{
|
||||
const struct extension *ext;
|
||||
|
||||
SPA_FOR_EACH_ELEMENT(extensions, ext) {
|
||||
SPA_FOR_EACH_ELEMENT_VAR(extensions, ext) {
|
||||
if (index == ext->index || spa_streq(name, ext->name))
|
||||
return ext;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -380,8 +380,7 @@ static AvahiStringList *get_service_txt(const struct service *s)
|
|||
txt = avahi_string_list_add_pair(txt, "channel_map", channel_map_snprint(cm, sizeof(cm), &s->cm));
|
||||
txt = avahi_string_list_add_pair(txt, "subtype", subtype_text[s->subtype]);
|
||||
|
||||
const struct mapping *m;
|
||||
SPA_FOR_EACH_ELEMENT(mappings, m) {
|
||||
SPA_FOR_EACH_ELEMENT_VAR(mappings, m) {
|
||||
const char *value = pw_properties_get(s->props, m->pw_key);
|
||||
if (value != NULL)
|
||||
txt = avahi_string_list_add_pair(txt, m->txt_key, value);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue