mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-06-05 03:01:53 -04:00
pipewire: properties: move value equality check
This commit is contained in:
parent
80011403d0
commit
5459c759ee
1 changed files with 10 additions and 6 deletions
|
|
@ -411,23 +411,27 @@ static int do_replace(struct pw_properties *properties, const char *key, char *v
|
|||
if (item == NULL) {
|
||||
if (value == NULL)
|
||||
return 0;
|
||||
|
||||
add_item(properties, strdup(key), copy ? strdup(value) : value);
|
||||
} else {
|
||||
if (value && spa_streq(item->value, value))
|
||||
goto exit_noupdate;
|
||||
if (value != NULL) {
|
||||
if (spa_streq(item->value, value))
|
||||
goto exit_noupdate;
|
||||
|
||||
if (value == NULL) {
|
||||
clear_item(item);
|
||||
remove_item(properties, item);
|
||||
} else {
|
||||
free((char *) item->value);
|
||||
item->value = copy ? strdup(value) : value;
|
||||
} else {
|
||||
clear_item(item);
|
||||
remove_item(properties, item);
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
||||
exit_noupdate:
|
||||
if (!copy)
|
||||
free(value);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue