pipewire: properties: rename add_func to add_item

In order to be consistent with `clear_item()` and `remove_item()`,
rename `add_func()` to `add_item()`.
This commit is contained in:
Barnabás Pőcze 2021-06-12 15:23:00 +02:00
parent 71c5fe0af6
commit be10eb8499

View file

@ -39,7 +39,7 @@ struct properties {
}; };
/** \endcond */ /** \endcond */
static int add_func(struct pw_properties *this, char *key, char *value) static int add_item(struct pw_properties *this, char *key, char *value)
{ {
struct spa_dict_item *item; struct spa_dict_item *item;
struct properties *impl = SPA_CONTAINER_OF(this, struct properties, this); struct properties *impl = SPA_CONTAINER_OF(this, struct properties, this);
@ -125,7 +125,7 @@ struct pw_properties *pw_properties_new(const char *key, ...)
while (key != NULL) { while (key != NULL) {
value = va_arg(varargs, char *); value = va_arg(varargs, char *);
if (value && key[0]) if (value && key[0])
add_func(&impl->this, strdup(key), strdup(value)); add_item(&impl->this, strdup(key), strdup(value));
key = va_arg(varargs, char *); key = va_arg(varargs, char *);
} }
va_end(varargs); va_end(varargs);
@ -152,8 +152,7 @@ struct pw_properties *pw_properties_new_dict(const struct spa_dict *dict)
spa_dict_for_each(it, dict) { spa_dict_for_each(it, dict) {
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_item(&impl->this, strdup(it->key), strdup(it->value));
strdup(it->value));
} }
SPA_FLAG_UPDATE(impl->this.dict.flags, SPA_DICT_FLAG_SORTED, SPA_FLAG_UPDATE(impl->this.dict.flags, SPA_DICT_FLAG_SORTED,
@ -406,7 +405,7 @@ static int do_replace(struct pw_properties *properties, const char *key, char *v
if (item == NULL) { if (item == NULL) {
if (value == NULL) if (value == NULL)
return 0; return 0;
add_func(properties, strdup(key), copy ? strdup(value) : value); add_item(properties, strdup(key), copy ? strdup(value) : value);
SPA_FLAG_CLEAR(properties->dict.flags, SPA_DICT_FLAG_SORTED); SPA_FLAG_CLEAR(properties->dict.flags, SPA_DICT_FLAG_SORTED);
} else { } else {
if (value && spa_streq(item->value, value)) if (value && spa_streq(item->value, value))