test/{DumpDatabase,run_neighbor_explorer}: add class GlobalInit

This commit is contained in:
Max Kellermann 2017-08-18 14:19:03 +02:00
parent b7d0890bc0
commit 9033f07724
2 changed files with 28 additions and 7 deletions

View File

@ -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);

View File

@ -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;