mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-04 13:30:12 -05: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
|
SPA_EXPORT
|
||||||
int pw_conf_save_state(const char *prefix, const char *name, struct pw_properties *conf)
|
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 path[PATH_MAX];
|
||||||
char *tmp_name;
|
char *tmp_name;
|
||||||
int res, sfd, fd, count = 0;
|
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");
|
f = fdopen(fd, "w");
|
||||||
fprintf(f, "{");
|
fprintf(f, "{");
|
||||||
spa_dict_for_each(it, &conf->dict) {
|
count += pw_properties_serialize_dict(f, &conf->dict, PW_PROPERTIES_FLAG_NL);
|
||||||
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);
|
|
||||||
}
|
|
||||||
fprintf(f, "%s}", count == 0 ? " " : "\n");
|
fprintf(f, "%s}", count == 0 ? " " : "\n");
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue