-static AvahiWatch* watch_new(const AvahiPoll *api, int fd, AvahiWatchEvent event, AvahiWatchCallback callback, void *userdata) {
+static gushort map_events_to_glib(AvahiWatchEvent events) {
+ return
+ (events & AVAHI_WATCH_IN ? G_IO_IN : 0) |
+ (events & AVAHI_WATCH_OUT ? G_IO_OUT : 0) |
+ (events & AVAHI_WATCH_ERR ? G_IO_ERR : 0) |
+ (events & AVAHI_WATCH_HUP ? G_IO_HUP : 0);
+}
+
+static AvahiWatchEvent map_events_from_glib(gushort events) {
+ return
+ (events & G_IO_IN ? AVAHI_WATCH_IN : 0) |
+ (events & G_IO_OUT ? AVAHI_WATCH_OUT : 0) |
+ (events & G_IO_ERR ? AVAHI_WATCH_ERR : 0) |
+ (events & G_IO_HUP ? AVAHI_WATCH_HUP : 0);
+}
+
+static AvahiWatch* watch_new(const AvahiPoll *api, int fd, AvahiWatchEvent events, AvahiWatchCallback callback, void *userdata) {