Lines Matching refs:w
68 static void destroy_watch(AvahiWatch *w) { in destroy_watch() argument
69 assert(w); in destroy_watch()
71 if (w->pollfd_added) in destroy_watch()
72 g_source_remove_poll(&w->glib_poll->source, &w->pollfd); in destroy_watch()
74 AVAHI_LLIST_REMOVE(AvahiWatch, watches, w->glib_poll->watches, w); in destroy_watch()
76 avahi_free(w); in destroy_watch()
80 AvahiWatch *w, *next; in cleanup_watches() local
83 for (w = g->watches; w; w = next) { in cleanup_watches()
84 next = w->watches_next; in cleanup_watches()
86 if (all || w->dead) in cleanup_watches()
87 destroy_watch(w); in cleanup_watches()
110 AvahiWatch *w; in watch_new() local
120 if (!(w = avahi_new(AvahiWatch, 1))) in watch_new()
123 w->glib_poll = g; in watch_new()
124 w->pollfd.fd = fd; in watch_new()
125 w->pollfd.events = map_events_to_glib(events); in watch_new()
126 w->pollfd.revents = 0; in watch_new()
127 w->callback = callback; in watch_new()
128 w->userdata = userdata; in watch_new()
129 w->dead = FALSE; in watch_new()
131 g_source_add_poll(&g->source, &w->pollfd); in watch_new()
132 w->pollfd_added = TRUE; in watch_new()
134 AVAHI_LLIST_PREPEND(AvahiWatch, watches, g->watches, w); in watch_new()
136 return w; in watch_new()
139 static void watch_update(AvahiWatch *w, AvahiWatchEvent events) { in watch_update() argument
140 assert(w); in watch_update()
141 assert(!w->dead); in watch_update()
143 w->pollfd.events = map_events_to_glib(events); in watch_update()
146 static AvahiWatchEvent watch_get_events(AvahiWatch *w) { in watch_get_events() argument
147 assert(w); in watch_get_events()
148 assert(!w->dead); in watch_get_events()
150 return map_events_from_glib(w->pollfd.revents); in watch_get_events()
153 static void watch_free(AvahiWatch *w) { in watch_free() argument
154 assert(w); in watch_free()
155 assert(!w->dead); in watch_free()
157 if (w->pollfd_added) { in watch_free()
158 g_source_remove_poll(&w->glib_poll->source, &w->pollfd); in watch_free()
159 w->pollfd_added = FALSE; in watch_free()
162 w->dead = TRUE; in watch_free()
163 w->glib_poll->timeout_req_cleanup = TRUE; in watch_free()
293 AvahiWatch *w; in check_func() local
309 for (w = g->watches; w; w = w->watches_next) in check_func()
310 if (w->pollfd.revents > 0) in check_func()
318 AvahiWatch *w; in dispatch_func() local
336 for (w = g->watches; w; w = w->watches_next) in dispatch_func()
337 if (w->pollfd.revents > 0) { in dispatch_func()
338 assert(w->callback); in dispatch_func()
339 w->callback(w, w->pollfd.fd, map_events_from_glib(w->pollfd.revents), w->userdata); in dispatch_func()
340 w->pollfd.revents = 0; in dispatch_func()