diff options
author | Eric Wong <normalperson@yhbt.net> | 2007-01-14 02:08:09 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2007-01-14 02:08:09 +0000 |
commit | 931c980558c5e561fe7c0891043be6382a6f33eb (patch) | |
tree | 50fbb7cf0783e4153cc2e03062407e0f88a92afd | |
parent | 8a38b28e860b6d0c1bf481dcf4023e0fda58bb95 (diff) | |
download | mpd-931c980558c5e561fe7c0891043be6382a6f33eb.tar.gz mpd-931c980558c5e561fe7c0891043be6382a6f33eb.tar.xz mpd-931c980558c5e561fe7c0891043be6382a6f33eb.zip |
zeroconf: avoid mixing declarations and code
git-svn-id: https://svn.musicpd.org/mpd/trunk@5243 09075e82-0dd4-0310-85a5-a0d7c8717e4f
-rw-r--r-- | src/zeroconf.c | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/src/zeroconf.c b/src/zeroconf.c index 0fa8d7398..cd54d9669 100644 --- a/src/zeroconf.c +++ b/src/zeroconf.c @@ -372,8 +372,9 @@ static int avahiFdset( fd_set* rfds, fd_set* wfds, fd_set* efds ) static int avahiFdconsume( int fdCount, fd_set* rfds, fd_set* wfds, fd_set* efds ) { int retval = fdCount; - + AvahiTimeout* t; AvahiWatch* w = avahiWatchList; + while( w != NULL && retval > 0 ) { AvahiWatch* current = w; current->observedEvent = 0; @@ -404,7 +405,7 @@ static int avahiFdconsume( int fdCount, fd_set* rfds, fd_set* wfds, fd_set* efds } } - AvahiTimeout* t = avahiTimeoutList; + t = avahiTimeoutList; while( t != NULL && avahiRunning ) { AvahiTimeout* current = t; @@ -418,19 +419,8 @@ static int avahiFdconsume( int fdCount, fd_set* rfds, fd_set* wfds, fd_set* efds return retval; } -#endif // HAVE_AVAHI - -void initZeroconf(void) +static void init_avahi(const char *serviceName) { - const char* serviceName = SERVICE_NAME; - ConfigParam *param; - - param = getConfigParam(CONF_ZEROCONF_NAME); - - if (param && strlen(param->value) > 0) - serviceName = param->value; - -#if HAVE_AVAHI int error; DEBUG( "Avahi: Initializing interface\n" ); @@ -468,7 +458,21 @@ void initZeroconf(void) fail: finishZeroconf(); -#endif // HAVE_AVAHI +} +#else /* !HAVE_AVAHI */ +static void init_avahi(const char *serviceName) { } +#endif /* HAVE_AVAHI */ + +void initZeroconf(void) +{ + const char* serviceName = SERVICE_NAME; + ConfigParam *param; + + param = getConfigParam(CONF_ZEROCONF_NAME); + + if (param && strlen(param->value) > 0) + serviceName = param->value; + init_avahi(serviceName); } void finishZeroconf(void) |