Skip to content

Commit

Permalink
options/parse_configfile: use stream_read_file2 for reading config
Browse files Browse the repository at this point in the history
Remove the duplication with stream_read_file2, which also handles
directory correctly.
  • Loading branch information
na-na-hi authored and kasper93 committed Oct 20, 2024
1 parent 8c3fd2c commit 607997d
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions options/parse_configfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

done:
free_stream(s);
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);

talloc_free(data.start);
return r;
}

0 comments on commit 607997d

Please sign in to comment.