X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=avahi-common%2Fwatch-test.c;h=cd70117574d38249ffd1a7edb18a96051e6292b1;hb=05dc243bdf89aae26c72434ddd7c27ab9143fec1;hp=ffb214982da3ca6eb4b496738fcedd20a7aea78a;hpb=769c00f228ba0d37217aaf1424dedde390e7a01c;p=catta diff --git a/avahi-common/watch-test.c b/avahi-common/watch-test.c index ffb2149..cd70117 100644 --- a/avahi-common/watch-test.c +++ b/avahi-common/watch-test.c @@ -32,11 +32,12 @@ #include "watch.h" #include "simple-watch.h" #include "timeval.h" +#include "gccmacro.h" static const AvahiPoll *api = NULL; static AvahiSimplePoll *simple_poll = NULL; -static void callback(AvahiWatch *w, int fd, AvahiWatchEvent event, void *userdata) { +static void callback(AvahiWatch *w, int fd, AvahiWatchEvent event, AVAHI_GCC_UNUSED void *userdata) { if (event & AVAHI_WATCH_IN) { ssize_t r; @@ -52,7 +53,7 @@ static void callback(AvahiWatch *w, int fd, AvahiWatchEvent event, void *userdat } } -static void wakeup(AvahiTimeout *t, void *userdata) { +static void wakeup(AvahiTimeout *t, AVAHI_GCC_UNUSED void *userdata) { static int i = 0; struct timeval tv; @@ -66,7 +67,7 @@ static void wakeup(AvahiTimeout *t, void *userdata) { } } -int main(int argc, char *argv[]) { +int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) { struct timeval tv; simple_poll = avahi_simple_poll_new(); @@ -78,9 +79,10 @@ int main(int argc, char *argv[]) { api->timeout_new(api, &tv, wakeup, NULL); /* Our main loop */ - for (;;) - if (avahi_simple_poll_iterate(simple_poll, -1) != 0) - break; + avahi_simple_poll_loop(simple_poll); + + + avahi_simple_poll_free(simple_poll); return 0; }