mirror of https://github.com/mpv-player/mpv
options/parse_configfile: use stream_read_file2 for reading config
Remove the duplication with stream_read_file2, which also handles directory correctly.
This commit is contained in:
parent
8c3fd2cd38
commit
607997db24
|
@ -165,16 +165,11 @@ int m_config_parse_config_file(m_config_t *config, struct mpv_global *global,
|
||||||
|
|
||||||
int r = 0;
|
int r = 0;
|
||||||
|
|
||||||
struct stream *s = stream_create(conffile, STREAM_READ | STREAM_ORIGIN_DIRECT,
|
bstr data = stream_read_file2(conffile, NULL, STREAM_ORIGIN_DIRECT | STREAM_READ,
|
||||||
NULL, global);
|
global, 1000000000);
|
||||||
if (!s)
|
if (data.start)
|
||||||
goto done;
|
r = m_config_parse(config, conffile, data, initial_section, flags);
|
||||||
bstr data = stream_read_complete(s, s, 1000000000);
|
|
||||||
if (!data.start)
|
|
||||||
goto done;
|
|
||||||
r = m_config_parse(config, conffile, data, initial_section, flags);
|
|
||||||
|
|
||||||
done:
|
talloc_free(data.start);
|
||||||
free_stream(s);
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue