From 607997db24bbf5a0a8c195a5553c9e8e508b1cb4 Mon Sep 17 00:00:00 2001 From: nanahi <130121847+na-na-hi@users.noreply.github.com> Date: Sat, 19 Oct 2024 15:27:03 -0400 Subject: [PATCH] options/parse_configfile: use stream_read_file2 for reading config Remove the duplication with stream_read_file2, which also handles directory correctly. --- options/parse_configfile.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/options/parse_configfile.c b/options/parse_configfile.c index f648f1b86b..fef03c96b0 100644 --- a/options/parse_configfile.c +++ b/options/parse_configfile.c @@ -165,16 +165,11 @@ int m_config_parse_config_file(m_config_t *config, struct mpv_global *global, int r = 0; - struct stream *s = stream_create(conffile, STREAM_READ | STREAM_ORIGIN_DIRECT, - NULL, global); - if (!s) - goto done; - bstr data = stream_read_complete(s, s, 1000000000); - if (!data.start) - goto done; - r = m_config_parse(config, conffile, data, initial_section, flags); + bstr data = stream_read_file2(conffile, NULL, STREAM_ORIGIN_DIRECT | STREAM_READ, + global, 1000000000); + if (data.start) + r = m_config_parse(config, conffile, data, initial_section, flags); -done: - free_stream(s); + talloc_free(data.start); return r; }