Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
140aeea3
Commit
140aeea3
authored
6 years ago
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Main: allocate ConfigData on the stack
parent
afd0fe66
sisyphus
0.23.15-alt1
0.23.14-alt1
0.23.13-alt1
0.23.12-alt1
0.23.11-alt1
0.23.8-alt3
0.23.8-alt2
0.23.8-alt1
0.21.24-alt1.1
0.21.24-alt1
gb-sisyphus-task339776.6100
gb-sisyphus-task337393.100
gb-sisyphus-task337176.300
gb-sisyphus-task334590.100
gb-sisyphus-task333607.100
gb-sisyphus-task331543.2500
gb-sisyphus-task328663.4700
gb-sisyphus-task325064.100
gb-sisyphus-task319111.4000
gb-sisyphus-task313704.100
gb-sisyphus-task312885.100
gb-sisyphus-task308905.3200
gb-sisyphus-task305294.500
gb-sisyphus-task304007.100
gb-sisyphus-task303674.1700
gb-sisyphus-task298681.300
gb-sisyphus-task296051.1000
gb-sisyphus-task274827.100
gb-sisyphus-task269249.2000
gb-sisyphus-task266579.400
gb-sisyphus-task258132.600
gb-sisyphus-task254601.200
No related merge requests found
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
15 deletions
+22
-15
CommandLine.cxx
src/CommandLine.cxx
+13
-7
CommandLine.hxx
src/CommandLine.hxx
+5
-2
Main.cxx
src/Main.cxx
+4
-6
No files found.
src/CommandLine.cxx
View file @
140aeea3
/*
* Copyright 2003-201
7
The Music Player Daemon Project
* Copyright 2003-201
8
The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
...
...
@@ -22,7 +22,7 @@
#include "ls.hxx"
#include "LogInit.hxx"
#include "Log.hxx"
#include "config/
Global
.hxx"
#include "config/
File
.hxx"
#include "decoder/DecoderList.hxx"
#include "decoder/DecoderPlugin.hxx"
#include "output/Registry.hxx"
...
...
@@ -292,7 +292,12 @@ static void help(void)
class
ConfigLoader
{
ConfigData
&
config
;
public
:
explicit
ConfigLoader
(
ConfigData
&
_config
)
noexcept
:
config
(
_config
)
{}
bool
TryFile
(
const
Path
path
);
bool
TryFile
(
const
AllocatedPath
&
base_path
,
Path
path
);
};
...
...
@@ -300,7 +305,7 @@ public:
bool
ConfigLoader
::
TryFile
(
Path
path
)
{
if
(
FileExists
(
path
))
{
ReadConfigFile
(
path
);
ReadConfigFile
(
config
,
path
);
return
true
;
}
return
false
;
...
...
@@ -315,7 +320,8 @@ bool ConfigLoader::TryFile(const AllocatedPath &base_path, Path path)
}
void
ParseCommandLine
(
int
argc
,
char
**
argv
,
struct
options
&
options
)
ParseCommandLine
(
int
argc
,
char
**
argv
,
struct
options
&
options
,
ConfigData
&
config
)
{
bool
use_config_file
=
true
;
...
...
@@ -383,16 +389,16 @@ ParseCommandLine(int argc, char **argv, struct options &options)
if
(
result
<=
0
)
throw
MakeLastError
(
"MultiByteToWideChar() failed"
);
ReadConfigFile
(
Path
::
FromFS
(
buffer
));
ReadConfigFile
(
config
,
Path
::
FromFS
(
buffer
));
#else
ReadConfigFile
(
Path
::
FromFS
(
config_file
));
ReadConfigFile
(
config
,
Path
::
FromFS
(
config_file
));
#endif
return
;
}
/* use default configuration file path */
ConfigLoader
loader
;
ConfigLoader
loader
(
config
)
;
bool
found
=
#ifdef _WIN32
...
...
This diff is collapsed.
Click to expand it.
src/CommandLine.hxx
View file @
140aeea3
/*
* Copyright 2003-201
7
The Music Player Daemon Project
* Copyright 2003-201
8
The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
...
...
@@ -20,6 +20,8 @@
#ifndef MPD_COMMAND_LINE_HXX
#define MPD_COMMAND_LINE_HXX
struct
ConfigData
;
struct
options
{
bool
kill
=
false
;
bool
daemon
=
true
;
...
...
@@ -28,6 +30,7 @@ struct options {
};
void
ParseCommandLine
(
int
argc
,
char
**
argv
,
struct
options
&
options
);
ParseCommandLine
(
int
argc
,
char
**
argv
,
struct
options
&
options
,
ConfigData
&
config
);
#endif
This diff is collapsed.
Click to expand it.
src/Main.cxx
View file @
140aeea3
...
...
@@ -52,7 +52,7 @@
#include "thread/Slack.hxx"
#include "net/Init.hxx"
#include "lib/icu/Init.hxx"
#include "config/
Global
.hxx"
#include "config/
File
.hxx"
#include "config/Check.hxx"
#include "config/Data.hxx"
#include "config/Param.hxx"
...
...
@@ -475,7 +475,7 @@ MainOrThrow(int argc, char *argv[])
const
ODBus
::
ScopeInit
dbus_init
;
#endif
config_global_init
()
;
ConfigData
raw_config
;
#ifdef ANDROID
(
void
)
argc
;
...
...
@@ -486,13 +486,12 @@ MainOrThrow(int argc, char *argv[])
const
auto
config_path
=
sdcard
/
Path
::
FromFS
(
"mpd.conf"
);
if
(
FileExists
(
config_path
))
ReadConfigFile
(
config_path
);
ReadConfigFile
(
raw_config
,
config_path
);
}
#else
ParseCommandLine
(
argc
,
argv
,
options
);
ParseCommandLine
(
argc
,
argv
,
options
,
raw_config
);
#endif
const
auto
&
raw_config
=
GetGlobalConfig
();
InitPathParser
(
raw_config
);
const
auto
config
=
LoadConfig
(
raw_config
);
...
...
@@ -714,7 +713,6 @@ mpd_main_after_fork(const ConfigData &raw_config, const Config &config)
#ifdef ENABLE_ARCHIVE
archive_plugin_deinit_all
();
#endif
config_global_finish
();
instance
->
rtio_thread
.
Stop
();
instance
->
io_thread
.
Stop
();
#ifndef ANDROID
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment