ZeroconfGlue: use struct ConfigData

This commit is contained in:
Max Kellermann 2018-07-17 22:44:16 +02:00
parent ad866f7a7d
commit bf582bd969
3 changed files with 10 additions and 9 deletions

View File

@ -593,7 +593,7 @@ try {
instance->neighbors->Open(); instance->neighbors->Open();
#endif #endif
ZeroconfInit(instance->event_loop); ZeroconfInit(GetGlobalConfig(), instance->event_loop);
for (auto &partition : instance->partitions) for (auto &partition : instance->partitions)
StartPlayerThread(partition.pc); StartPlayerThread(partition.pc);

View File

@ -21,7 +21,7 @@
#include "ZeroconfGlue.hxx" #include "ZeroconfGlue.hxx"
#include "ZeroconfAvahi.hxx" #include "ZeroconfAvahi.hxx"
#include "ZeroconfBonjour.hxx" #include "ZeroconfBonjour.hxx"
#include "config/Global.hxx" #include "config/Data.hxx"
#include "config/Option.hxx" #include "config/Option.hxx"
#include "Listen.hxx" #include "Listen.hxx"
#include "util/Domain.hxx" #include "util/Domain.hxx"
@ -40,11 +40,11 @@ static constexpr Domain zeroconf_domain("zeroconf");
static int zeroconfEnabled; static int zeroconfEnabled;
void void
ZeroconfInit(gcc_unused EventLoop &loop) ZeroconfInit(const ConfigData &config, gcc_unused EventLoop &loop)
{ {
const char *serviceName; const char *serviceName;
zeroconfEnabled = config_get_bool(ConfigOption::ZEROCONF_ENABLED, zeroconfEnabled = config.GetBool(ConfigOption::ZEROCONF_ENABLED,
DEFAULT_ZEROCONF_ENABLED); DEFAULT_ZEROCONF_ENABLED);
if (!zeroconfEnabled) if (!zeroconfEnabled)
return; return;
@ -56,7 +56,7 @@ ZeroconfInit(gcc_unused EventLoop &loop)
return; return;
} }
serviceName = config_get_string(ConfigOption::ZEROCONF_NAME, serviceName = config.GetString(ConfigOption::ZEROCONF_NAME,
SERVICE_NAME); SERVICE_NAME);
#ifdef HAVE_AVAHI #ifdef HAVE_AVAHI

View File

@ -22,12 +22,13 @@
#include "check.h" #include "check.h"
struct ConfigData;
class EventLoop; class EventLoop;
#ifdef HAVE_ZEROCONF #ifdef HAVE_ZEROCONF
void void
ZeroconfInit(EventLoop &loop); ZeroconfInit(const ConfigData &config, EventLoop &loop);
void void
ZeroconfDeinit(); ZeroconfDeinit();
@ -35,7 +36,7 @@ ZeroconfDeinit();
#else /* ! HAVE_ZEROCONF */ #else /* ! HAVE_ZEROCONF */
static inline void static inline void
ZeroconfInit(EventLoop &) ZeroconfInit(const ConfigData &, EventLoop &)
{} {}
static inline void static inline void