From 854f901f491ccda79aee11edc3d59109cb229d28 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 26 Oct 2005 21:27:40 +0000 Subject: * avahi-utils: replace python avahi-browse with a version written in C. * remove -Wunused from GCC command line and use "unused" attribute instead * remove AVAHI_CLIENT_S_FAILURE and AVAHI_CLIENT_S_INVALID since these event's are never forwarded to the client anyway * make use of AVAHI_GCC_NORETURN * really send eror code with StateChange DBUS signals * ignore EINTR in avahi_simple_poll_loop() git-svn-id: file:///home/lennart/svn/public/avahi/trunk@879 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe --- examples/Makefile.am | 1 - examples/client-browse-services.c | 13 ++++++------- examples/client-publish-service.c | 8 +++----- examples/core-browse-services.c | 10 +++++----- examples/core-publish-service.c | 6 +++--- examples/glib-integration.c | 6 +++--- 6 files changed, 20 insertions(+), 24 deletions(-) (limited to 'examples') diff --git a/examples/Makefile.am b/examples/Makefile.am index 92cdccd..e6e66f5 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -33,7 +33,6 @@ core_browse_services_SOURCES = core-browse-services.c core_browse_services_CFLAGS = $(AM_CFLAGS) core_browse_services_LDADD = $(AM_LDADD) ../avahi-core/libavahi-core.la ../avahi-common/libavahi-common.la - if HAVE_DBUS if ENABLE_TESTS diff --git a/examples/client-browse-services.c b/examples/client-browse-services.c index 5ebbf2d..c5a1cbd 100644 --- a/examples/client-browse-services.c +++ b/examples/client-browse-services.c @@ -39,8 +39,8 @@ static AvahiSimplePoll *simple_poll = NULL; static void resolve_callback( AvahiServiceResolver *r, - AvahiIfIndex interface, - AvahiProtocol protocol, + AVAHI_GCC_UNUSED AvahiIfIndex interface, + AVAHI_GCC_UNUSED AvahiProtocol protocol, AvahiResolverEvent event, const char *name, const char *type, @@ -50,7 +50,7 @@ static void resolve_callback( uint16_t port, AvahiStringList *txt, AvahiLookupResultFlags flags, - void* userdata) { + AVAHI_GCC_UNUSED void* userdata) { assert(r); @@ -101,7 +101,7 @@ static void browse_callback( const char *name, const char *type, const char *domain, - AvahiLookupResultFlags flags, + AVAHI_GCC_UNUSED AvahiLookupResultFlags flags, void* userdata) { AvahiClient *c = userdata; @@ -137,11 +137,10 @@ static void browse_callback( case AVAHI_BROWSER_CACHE_EXHAUSTED: fprintf(stderr, "(Browser) %s\n", event == AVAHI_BROWSER_CACHE_EXHAUSTED ? "CACHE_EXHAUSTED" : "ALL_FOR_NOW"); break; - } } -static void client_callback(AvahiClient *c, AvahiClientState state, void * userdata) { +static void client_callback(AvahiClient *c, AvahiClientState state, AVAHI_GCC_UNUSED void * userdata) { assert(c); /* Called whenever the client or server state changes */ @@ -152,7 +151,7 @@ static void client_callback(AvahiClient *c, AvahiClientState state, void * userd } } -int main(int argc, char*argv[]) { +int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char*argv[]) { AvahiClient *client = NULL; AvahiServiceBrowser *sb = NULL; int error; diff --git a/examples/client-publish-service.c b/examples/client-publish-service.c index d99c46b..7013156 100644 --- a/examples/client-publish-service.c +++ b/examples/client-publish-service.c @@ -42,7 +42,7 @@ static char *name = NULL; static void create_services(AvahiClient *c); -static void entry_group_callback(AvahiEntryGroup *g, AvahiEntryGroupState state, void *userdata) { +static void entry_group_callback(AvahiEntryGroup *g, AvahiEntryGroupState state, AVAHI_GCC_UNUSED void *userdata) { assert(g == group); /* Called whenever the entry group state changes */ @@ -127,7 +127,7 @@ fail: avahi_simple_poll_quit(simple_poll); } -static void client_callback(AvahiClient *c, AvahiClientState state, void * userdata) { +static void client_callback(AvahiClient *c, AvahiClientState state, AVAHI_GCC_UNUSED void * userdata) { assert(c); /* Called whenever the client or server state changes */ @@ -157,14 +157,12 @@ static void client_callback(AvahiClient *c, AvahiClientState state, void * userd break; - case AVAHI_CLIENT_S_FAILURE: - case AVAHI_CLIENT_S_INVALID: case AVAHI_CLIENT_S_REGISTERING: ; } } -int main(int argc, char*argv[]) { +int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char*argv[]) { AvahiClient *client = NULL; int error; int ret = 1; diff --git a/examples/core-browse-services.c b/examples/core-browse-services.c index db2dcb9..a34281e 100644 --- a/examples/core-browse-services.c +++ b/examples/core-browse-services.c @@ -50,8 +50,8 @@ static AvahiServer *server = NULL; static void resolve_callback( AvahiSServiceResolver *r, - AvahiIfIndex interface, - AvahiProtocol protocol, + AVAHI_GCC_UNUSED AvahiIfIndex interface, + AVAHI_GCC_UNUSED AvahiProtocol protocol, AvahiResolverEvent event, const char *name, const char *type, @@ -61,7 +61,7 @@ static void resolve_callback( uint16_t port, AvahiStringList *txt, AvahiLookupResultFlags flags, - void* userdata) { + AVAHI_GCC_UNUSED void* userdata) { assert(r); @@ -109,7 +109,7 @@ static void browse_callback( const char *name, const char *type, const char *domain, - AvahiLookupResultFlags flags, + AVAHI_GCC_UNUSED AvahiLookupResultFlags flags, void* userdata) { AvahiServer *s = userdata; @@ -149,7 +149,7 @@ static void browse_callback( } } -int main(int argc, char*argv[]) { +int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char*argv[]) { AvahiServerConfig config; AvahiSServiceBrowser *sb = NULL; int error; diff --git a/examples/core-publish-service.c b/examples/core-publish-service.c index f5cadea..65dfe5d 100644 --- a/examples/core-publish-service.c +++ b/examples/core-publish-service.c @@ -41,7 +41,7 @@ static char *name = NULL; static void create_services(AvahiServer *s); -static void entry_group_callback(AvahiServer *s, AvahiSEntryGroup *g, AvahiEntryGroupState state, void *userdata) { +static void entry_group_callback(AvahiServer *s, AvahiSEntryGroup *g, AvahiEntryGroupState state, AVAHI_GCC_UNUSED void *userdata) { assert(s); assert(g == group); @@ -129,7 +129,7 @@ fail: avahi_simple_poll_quit(simple_poll); } -static void server_callback(AvahiServer *s, AvahiServerState state, void * userdata) { +static void server_callback(AvahiServer *s, AvahiServerState state, AVAHI_GCC_UNUSED void * userdata) { assert(s); /* Called whenever the server state changes */ @@ -185,7 +185,7 @@ static void server_callback(AvahiServer *s, AvahiServerState state, void * userd } } -int main(int argc, char*argv[]) { +int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char*argv[]) { AvahiServerConfig config; AvahiServer *server = NULL; int error; diff --git a/examples/glib-integration.c b/examples/glib-integration.c index 8957128..bf6eacf 100644 --- a/examples/glib-integration.c +++ b/examples/glib-integration.c @@ -33,7 +33,7 @@ /* Callback for Avahi API Timeout Event */ static void -avahi_timeout_event (AvahiTimeout *timeout, void *userdata) +avahi_timeout_event (AVAHI_GCC_UNUSED AvahiTimeout *timeout, AVAHI_GCC_UNUSED void *userdata) { g_message ("Avahi API Timeout reached!"); } @@ -54,7 +54,7 @@ avahi_timeout_event_glib (void *userdata) /* Callback for state changes on the Client */ static void -avahi_client_callback (AvahiClient *client, AvahiClientState state, void *userdata) +avahi_client_callback (AVAHI_GCC_UNUSED AvahiClient *client, AvahiClientState state, void *userdata) { GMainLoop *loop = userdata; @@ -71,7 +71,7 @@ avahi_client_callback (AvahiClient *client, AvahiClientState state, void *userda } int -main (int argc, char *argv[]) +main (AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) { GMainLoop *loop = NULL; const AvahiPoll *poll_api; -- cgit