static AvahiWatch * ev_watch_new(const AvahiPoll *api, int fd, AvahiWatchEvent a_events, AvahiWatchCallback cb, void *userdata) { AvahiWatch *w; int ret; w = (AvahiWatch *)malloc(sizeof(AvahiWatch)); if (!w) return NULL; memset(w, 0, sizeof(AvahiWatch)); w->cb = cb; w->userdata = userdata; ret = _ev_watch_add(w, fd, a_events); if (ret != 0) { free(w); return NULL; } w->next = all_w; all_w = w; return w; }
static void ev_watch_update(AvahiWatch *w, AvahiWatchEvent a_events) { event_del(&w->ev); _ev_watch_add(w, EVENT_FD(&w->ev), a_events); }
static void ev_watch_update(AvahiWatch *w, AvahiWatchEvent a_events) { if (w->ev) event_del(w->ev); _ev_watch_add(w, (int)event_get_fd(w->ev), a_events); }