pipewire: properties: use for-each loop

Use spa_dict_for_each instead of open-coding the loop.
This commit is contained in:
Barnabás Pőcze 2021-06-12 14:47:44 +02:00
parent c3d7561d17
commit b04bffa5a9

View file

@ -125,15 +125,14 @@ struct pw_properties *pw_properties_new(const char *key, ...)
SPA_EXPORT
struct pw_properties *pw_properties_new_dict(const struct spa_dict *dict)
{
uint32_t i;
const struct spa_dict_item *it;
struct properties *impl;
impl = properties_new(SPA_ROUND_UP_N(dict->n_items, 16));
if (impl == NULL)
return NULL;
for (i = 0; i < dict->n_items; i++) {
const struct spa_dict_item *it = &dict->items[i];
spa_dict_for_each(it, dict) {
if (it->key != NULL && it->key[0] && it->value != NULL)
add_func(&impl->this, strdup(it->key),
strdup(it->value));