mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-06-07 03:01:36 -04:00
pipewire: properties: clear sorted flag in add/remove
Move the clearing of the SPA_DICT_FLAG_SORTED into `add_item()` and `remove_item()`.
This commit is contained in:
parent
be10eb8499
commit
80011403d0
1 changed files with 6 additions and 2 deletions
|
|
@ -56,6 +56,9 @@ static int add_item(struct pw_properties *this, char *key, char *value)
|
||||||
|
|
||||||
this->dict.items = impl->items.data;
|
this->dict.items = impl->items.data;
|
||||||
this->dict.n_items++;
|
this->dict.n_items++;
|
||||||
|
|
||||||
|
SPA_FLAG_CLEAR(this->dict.flags, SPA_DICT_FLAG_SORTED);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -66,8 +69,11 @@ static void remove_item(struct pw_properties *this, struct spa_dict_item *item)
|
||||||
|
|
||||||
item->key = last->key;
|
item->key = last->key;
|
||||||
item->value = last->value;
|
item->value = last->value;
|
||||||
|
|
||||||
impl->items.size -= sizeof(*item);
|
impl->items.size -= sizeof(*item);
|
||||||
this->dict.n_items--;
|
this->dict.n_items--;
|
||||||
|
|
||||||
|
SPA_FLAG_CLEAR(this->dict.flags, SPA_DICT_FLAG_SORTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void clear_item(struct spa_dict_item *item)
|
static void clear_item(struct spa_dict_item *item)
|
||||||
|
|
@ -406,7 +412,6 @@ static int do_replace(struct pw_properties *properties, const char *key, char *v
|
||||||
if (value == NULL)
|
if (value == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
add_item(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);
|
|
||||||
} else {
|
} else {
|
||||||
if (value && spa_streq(item->value, value))
|
if (value && spa_streq(item->value, value))
|
||||||
goto exit_noupdate;
|
goto exit_noupdate;
|
||||||
|
|
@ -414,7 +419,6 @@ static int do_replace(struct pw_properties *properties, const char *key, char *v
|
||||||
if (value == NULL) {
|
if (value == NULL) {
|
||||||
clear_item(item);
|
clear_item(item);
|
||||||
remove_item(properties, item);
|
remove_item(properties, item);
|
||||||
SPA_FLAG_CLEAR(properties->dict.flags, SPA_DICT_FLAG_SORTED);
|
|
||||||
} else {
|
} else {
|
||||||
free((char *) item->value);
|
free((char *) item->value);
|
||||||
item->value = copy ? strdup(value) : value;
|
item->value = copy ? strdup(value) : value;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue