diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/DumpDatabase.cxx | 14 | ||||
-rw-r--r-- | test/run_neighbor_explorer.cxx | 21 |
2 files changed, 28 insertions, 7 deletions
diff --git a/test/DumpDatabase.cxx b/test/DumpDatabase.cxx index bb778b4ff..c1d289a1c 100644 --- a/test/DumpDatabase.cxx +++ b/test/DumpDatabase.cxx @@ -43,6 +43,17 @@ using std::endl; #include <stdlib.h> +class GlobalInit { +public: + GlobalInit() { + config_global_init(); + } + + ~GlobalInit() { + config_global_finish(); + } +}; + #ifdef ENABLE_UPNP #include "input/InputStream.hxx" size_t @@ -104,8 +115,7 @@ try { /* initialize MPD */ - config_global_init(); - AtScopeExit() { config_global_finish(); }; + GlobalInit init; ReadConfigFile(config_path); diff --git a/test/run_neighbor_explorer.cxx b/test/run_neighbor_explorer.cxx index 399e806aa..f07f1af21 100644 --- a/test/run_neighbor_explorer.cxx +++ b/test/run_neighbor_explorer.cxx @@ -29,6 +29,17 @@ #include <stdio.h> #include <stdlib.h> +class GlobalInit { +public: + GlobalInit() { + config_global_init(); + } + + ~GlobalInit() { + config_global_finish(); + } +}; + class MyNeighborListener final : public NeighborListener { public: /* virtual methods from class NeighborListener */ @@ -53,15 +64,15 @@ try { const Path config_path = Path::FromFS(argv[1]); - /* read configuration file (mpd.conf) */ - - config_global_init(); - ReadConfigFile(config_path); - /* initialize the core */ + GlobalInit init; EventLoop loop; + /* read configuration file (mpd.conf) */ + + ReadConfigFile(config_path); + /* initialize neighbor plugins */ MyNeighborListener listener; |