Main: add local ConfigData reference

This commit is contained in:
Max Kellermann 2018-07-17 22:48:43 +02:00
parent bf582bd969
commit a5b14a2ea7

View File

@ -453,7 +453,7 @@ int main(int argc, char *argv[])
#endif #endif
static int static int
mpd_main_after_fork(const Config &config); mpd_main_after_fork(const ConfigData &raw_config, const Config &config);
#ifdef ANDROID #ifdef ANDROID
static inline static inline
@ -495,13 +495,14 @@ try {
ParseCommandLine(argc, argv, options); ParseCommandLine(argc, argv, options);
#endif #endif
const auto config = LoadConfig(GetGlobalConfig()); const auto &raw_config = GetGlobalConfig();
const auto config = LoadConfig(raw_config);
#ifdef ENABLE_DAEMON #ifdef ENABLE_DAEMON
glue_daemonize_init(&options); glue_daemonize_init(&options);
#endif #endif
TagLoadConfig(GetGlobalConfig()); TagLoadConfig(raw_config);
log_init(options.verbose, options.log_stderr); log_init(options.verbose, options.log_stderr);
@ -531,7 +532,7 @@ try {
daemonize_begin(options.daemon); daemonize_begin(options.daemon);
#endif #endif
return mpd_main_after_fork(config); return mpd_main_after_fork(raw_config, config);
} catch (const std::exception &e) { } catch (const std::exception &e) {
LogError(e); LogError(e);
@ -539,24 +540,24 @@ try {
} }
static int static int
mpd_main_after_fork(const Config &config) mpd_main_after_fork(const ConfigData &raw_config, const Config &config)
try { try {
ConfigureFS(); ConfigureFS();
glue_mapper_init(); glue_mapper_init();
initPermissions(); initPermissions();
spl_global_init(GetGlobalConfig()); spl_global_init(raw_config);
#ifdef ENABLE_ARCHIVE #ifdef ENABLE_ARCHIVE
archive_plugin_init_all(); archive_plugin_init_all();
#endif #endif
pcm_convert_global_init(); pcm_convert_global_init();
decoder_plugin_init_all(GetGlobalConfig()); decoder_plugin_init_all(raw_config);
#ifdef ENABLE_DATABASE #ifdef ENABLE_DATABASE
const bool create_db = InitDatabaseAndStorage(GetGlobalConfig()); const bool create_db = InitDatabaseAndStorage(raw_config);
#endif #endif
glue_sticker_init(); glue_sticker_init();
@ -571,9 +572,9 @@ try {
} }
client_manager_init(); client_manager_init();
input_stream_global_init(GetGlobalConfig(), input_stream_global_init(raw_config,
instance->io_thread.GetEventLoop()); instance->io_thread.GetEventLoop());
playlist_list_global_init(GetGlobalConfig()); playlist_list_global_init(raw_config);
#ifdef ENABLE_DAEMON #ifdef ENABLE_DAEMON
daemonize_commit(); daemonize_commit();
@ -593,7 +594,7 @@ try {
instance->neighbors->Open(); instance->neighbors->Open();
#endif #endif
ZeroconfInit(GetGlobalConfig(), instance->event_loop); ZeroconfInit(raw_config, instance->event_loop);
for (auto &partition : instance->partitions) for (auto &partition : instance->partitions)
StartPlayerThread(partition.pc); StartPlayerThread(partition.pc);