mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-06-06 03:02:54 -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 (item == NULL) {
|
||||||
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);
|
||||||
} else {
|
} else {
|
||||||
if (value && spa_streq(item->value, value))
|
if (value != NULL) {
|
||||||
|
if (spa_streq(item->value, value))
|
||||||
goto exit_noupdate;
|
goto exit_noupdate;
|
||||||
|
|
||||||
if (value == NULL) {
|
|
||||||
clear_item(item);
|
|
||||||
remove_item(properties, item);
|
|
||||||
} else {
|
|
||||||
free((char *) item->value);
|
free((char *) item->value);
|
||||||
item->value = copy ? strdup(value) : value;
|
item->value = copy ? strdup(value) : value;
|
||||||
|
} else {
|
||||||
|
clear_item(item);
|
||||||
|
remove_item(properties, item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
exit_noupdate:
|
exit_noupdate:
|
||||||
if (!copy)
|
if (!copy)
|
||||||
free(value);
|
free(value);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue