mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-06-06 03:02:54 -04:00
pipewire: properties: use for-each loop
Use spa_dict_for_each instead of open-coding the loop.
This commit is contained in:
parent
c3d7561d17
commit
b04bffa5a9
1 changed files with 2 additions and 3 deletions
|
|
@ -125,15 +125,14 @@ struct pw_properties *pw_properties_new(const char *key, ...)
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
struct pw_properties *pw_properties_new_dict(const struct spa_dict *dict)
|
struct pw_properties *pw_properties_new_dict(const struct spa_dict *dict)
|
||||||
{
|
{
|
||||||
uint32_t i;
|
const struct spa_dict_item *it;
|
||||||
struct properties *impl;
|
struct properties *impl;
|
||||||
|
|
||||||
impl = properties_new(SPA_ROUND_UP_N(dict->n_items, 16));
|
impl = properties_new(SPA_ROUND_UP_N(dict->n_items, 16));
|
||||||
if (impl == NULL)
|
if (impl == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
for (i = 0; i < dict->n_items; i++) {
|
spa_dict_for_each(it, dict) {
|
||||||
const struct spa_dict_item *it = &dict->items[i];
|
|
||||||
if (it->key != NULL && it->key[0] && it->value != NULL)
|
if (it->key != NULL && it->key[0] && it->value != NULL)
|
||||||
add_func(&impl->this, strdup(it->key),
|
add_func(&impl->this, strdup(it->key),
|
||||||
strdup(it->value));
|
strdup(it->value));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue