Main: add struct Config, empty currently

This commit is contained in:
Max Kellermann 2016-12-10 00:00:50 +01:00
parent 3d897f18cd
commit d2a1294e9a

View File

@ -127,6 +127,16 @@ Context *context;
Instance *instance; Instance *instance;
struct Config {
};
gcc_const
static Config
LoadConfig()
{
return {};
}
#ifdef ENABLE_DAEMON #ifdef ENABLE_DAEMON
static void static void
@ -383,7 +393,7 @@ int main(int argc, char *argv[])
#endif #endif
static int static int
mpd_main_after_fork(); mpd_main_after_fork(const Config &config);
#ifdef ANDROID #ifdef ANDROID
static inline static inline
@ -425,6 +435,8 @@ try {
ParseCommandLine(argc, argv, &options); ParseCommandLine(argc, argv, &options);
#endif #endif
const auto config = LoadConfig();
#ifdef ENABLE_DAEMON #ifdef ENABLE_DAEMON
glue_daemonize_init(&options); glue_daemonize_init(&options);
#endif #endif
@ -468,12 +480,12 @@ try {
This must be run after forking; if dispatch is called before forking, This must be run after forking; if dispatch is called before forking,
the child process will have a broken internal dispatch state. */ the child process will have a broken internal dispatch state. */
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
exit(mpd_main_after_fork()); exit(mpd_main_after_fork(config));
}); });
dispatch_main(); dispatch_main();
return EXIT_FAILURE; // unreachable, because dispatch_main never returns return EXIT_FAILURE; // unreachable, because dispatch_main never returns
#else #else
return mpd_main_after_fork(); return mpd_main_after_fork(config);
#endif #endif
} catch (const std::exception &e) { } catch (const std::exception &e) {
LogError(e); LogError(e);
@ -481,8 +493,10 @@ try {
} }
static int static int
mpd_main_after_fork() mpd_main_after_fork(const Config &config)
try { try {
(void)config;
ConfigureFS(); ConfigureFS();
glue_mapper_init(); glue_mapper_init();