summaryrefslogtreecommitdiffstats
path: root/avahi-common
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2005-10-26 21:27:40 +0000
committerLennart Poettering <lennart@poettering.net>2005-10-26 21:27:40 +0000
commit854f901f491ccda79aee11edc3d59109cb229d28 (patch)
treecfaf27b1e11af5c7504e6825e205d9d1ed2c6035 /avahi-common
parent740bc001fb647255709b5385d5a8a19781722097 (diff)
* 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
Diffstat (limited to 'avahi-common')
-rw-r--r--avahi-common/alternative-test.c2
-rw-r--r--avahi-common/dbus-watch-glue.c7
-rw-r--r--avahi-common/domain-test.c2
-rw-r--r--avahi-common/gccmacro.h7
-rw-r--r--avahi-common/simple-watch.c5
-rw-r--r--avahi-common/strlst-test.c2
-rw-r--r--avahi-common/timeval-test.c4
-rw-r--r--avahi-common/watch-test.c7
8 files changed, 24 insertions, 12 deletions
diff --git a/avahi-common/alternative-test.c b/avahi-common/alternative-test.c
index 7ec0f33..010478c 100644
--- a/avahi-common/alternative-test.c
+++ b/avahi-common/alternative-test.c
@@ -28,7 +28,7 @@
#include "alternative.h"
#include "malloc.h"
-int main(int argc, char *argv[]) {
+int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
char *r = NULL;
int i, k;
diff --git a/avahi-common/dbus-watch-glue.c b/avahi-common/dbus-watch-glue.c
index 46fcc90..b2b4bb2 100644
--- a/avahi-common/dbus-watch-glue.c
+++ b/avahi-common/dbus-watch-glue.c
@@ -106,8 +106,9 @@ static void dispatch_timeout_callback(AvahiTimeout *t, void *userdata) {
connection_data_unref(d);
}
-static void watch_callback(AvahiWatch *avahi_watch, int fd, AvahiWatchEvent events, void *userdata) {
+static void watch_callback(AvahiWatch *avahi_watch, AVAHI_GCC_UNUSED int fd, AvahiWatchEvent events, void *userdata) {
DBusWatch *dbus_watch = userdata;
+
assert(avahi_watch);
assert(dbus_watch);
@@ -286,7 +287,7 @@ static void remove_timeout(DBusTimeout *dbus_timeout, void *userdata) {
timeout->avahi_timeout = NULL;
}
-static void timeout_toggled(DBusTimeout *dbus_timeout, void *userdata) {
+static void timeout_toggled(DBusTimeout *dbus_timeout, AVAHI_GCC_UNUSED void *userdata) {
TimeoutData *timeout;
assert(dbus_timeout);
@@ -296,7 +297,7 @@ static void timeout_toggled(DBusTimeout *dbus_timeout, void *userdata) {
update_timeout(timeout);
}
-static void dispatch_status(DBusConnection *connection, DBusDispatchStatus new_status, void *userdata) {
+static void dispatch_status(AVAHI_GCC_UNUSED DBusConnection *connection, DBusDispatchStatus new_status, void *userdata) {
ConnectionData *d = userdata;
if (new_status == DBUS_DISPATCH_DATA_REMAINS)
diff --git a/avahi-common/domain-test.c b/avahi-common/domain-test.c
index b765532..c9ff32e 100644
--- a/avahi-common/domain-test.c
+++ b/avahi-common/domain-test.c
@@ -30,7 +30,7 @@
#include "domain.h"
#include "malloc.h"
-int main(int argc, char *argv[]) {
+int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
char *s;
char t[256], r[256];
const char *p;
diff --git a/avahi-common/gccmacro.h b/avahi-common/gccmacro.h
index c32a29d..2e427b7 100644
--- a/avahi-common/gccmacro.h
+++ b/avahi-common/gccmacro.h
@@ -59,6 +59,13 @@ AVAHI_C_DECL_BEGIN
#define AVAHI_GCC_NORETURN
#endif
+#ifdef __GNUC__
+#define AVAHI_GCC_UNUSED __attribute__ ((unused))
+#else
+/** Macro for not used parameter */
+#define AVAHI_GCC_UNUSED
+#endif
+
AVAHI_C_DECL_END
#endif
diff --git a/avahi-common/simple-watch.c b/avahi-common/simple-watch.c
index 3633521..65d9d18 100644
--- a/avahi-common/simple-watch.c
+++ b/avahi-common/simple-watch.c
@@ -619,7 +619,7 @@ const AvahiPoll* avahi_simple_poll_get(AvahiSimplePoll *s) {
return &s->api;
}
-static int system_poll(struct pollfd *ufds, unsigned int nfds, int timeout, void *userdata) {
+static int system_poll(struct pollfd *ufds, unsigned int nfds, int timeout, AVAHI_GCC_UNUSED void *userdata) {
return poll(ufds, nfds, timeout);
}
@@ -640,5 +640,6 @@ int avahi_simple_poll_loop(AvahiSimplePoll *s) {
for (;;)
if ((r = avahi_simple_poll_iterate(s, -1)) != 0)
- return r;
+ if (r >= 0 || errno != EINTR)
+ return r;
}
diff --git a/avahi-common/strlst-test.c b/avahi-common/strlst-test.c
index abca86d..68dc472 100644
--- a/avahi-common/strlst-test.c
+++ b/avahi-common/strlst-test.c
@@ -29,7 +29,7 @@
#include "strlst.h"
#include "malloc.h"
-int main(int argc, char *argv[]) {
+int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
char *t, *v;
uint8_t data[1024];
AvahiStringList *a = NULL, *b, *p;
diff --git a/avahi-common/timeval-test.c b/avahi-common/timeval-test.c
index 4b594d4..92fcab2 100644
--- a/avahi-common/timeval-test.c
+++ b/avahi-common/timeval-test.c
@@ -24,9 +24,11 @@
#endif
#include <stdio.h>
+
+#include "gccmacro.h"
#include "timeval.h"
-int main(int argc, char *argv[]) {
+int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
struct timeval a = { 5, 5 }, b;
diff --git a/avahi-common/watch-test.c b/avahi-common/watch-test.c
index 921a8f7..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();