X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=avahi-common%2Fwatch-test.c;h=cd70117574d38249ffd1a7edb18a96051e6292b1;hb=05dc243bdf89aae26c72434ddd7c27ab9143fec1;hp=a9e3e0285c8d0fca272f059607fed6c820855afb;hpb=fcc9b0efe1accdb0edcb3143a8e15782e69383db;p=catta diff --git a/avahi-common/watch-test.c b/avahi-common/watch-test.c index a9e3e02..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(AvahiPoll *_api, void *userdata) { +static void wakeup(AvahiTimeout *t, AVAHI_GCC_UNUSED void *userdata) { static int i = 0; struct timeval tv; @@ -62,11 +63,11 @@ static void wakeup(AvahiPoll *_api, void *userdata) { avahi_simple_poll_quit(simple_poll); else { avahi_elapse_time(&tv, 1000, 0); - api->set_wakeup(api, &tv, wakeup, NULL); + api->timeout_update(t, &tv); } } -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(); @@ -75,12 +76,13 @@ int main(int argc, char *argv[]) { api->watch_new(api, 0, AVAHI_WATCH_IN, callback, NULL); avahi_elapse_time(&tv, 1000, 0); - api->set_wakeup(api, &tv, wakeup, NULL); + 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; }