mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-01 22:58:50 -04:00
conf: use serialize_dict to write state files
Instead of our home-brew version.
This commit is contained in:
parent
54326abd54
commit
262e609b73
1 changed files with 1 additions and 9 deletions
|
|
@ -215,7 +215,6 @@ found:
|
|||
SPA_EXPORT
|
||||
int pw_conf_save_state(const char *prefix, const char *name, struct pw_properties *conf)
|
||||
{
|
||||
const struct spa_dict_item *it;
|
||||
char path[PATH_MAX];
|
||||
char *tmp_name;
|
||||
int res, sfd, fd, count = 0;
|
||||
|
|
@ -234,14 +233,7 @@ int pw_conf_save_state(const char *prefix, const char *name, struct pw_propertie
|
|||
|
||||
f = fdopen(fd, "w");
|
||||
fprintf(f, "{");
|
||||
spa_dict_for_each(it, &conf->dict) {
|
||||
char key[1024];
|
||||
|
||||
if (spa_json_encode_string(key, sizeof(key)-1, it->key) >= (int)sizeof(key)-1)
|
||||
continue;
|
||||
|
||||
fprintf(f, "%s\n %s: %s", count++ == 0 ? "" : ",", key, it->value);
|
||||
}
|
||||
count += pw_properties_serialize_dict(f, &conf->dict, PW_PROPERTIES_FLAG_NL);
|
||||
fprintf(f, "%s}", count == 0 ? " " : "\n");
|
||||
fclose(f);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue