diff --git a/src/cache.c b/src/cache.c index 7e49716e..e1276a59 100644 --- a/src/cache.c +++ b/src/cache.c @@ -873,7 +873,7 @@ cache_daap_update(void *arg, int *retval) /* Callback from filescanner thread */ static void -cache_daap_listener_cb(enum listener_event_type type) +cache_daap_listener_cb(short event_mask) { commands_exec_async(cmdbase, cache_daap_update, NULL); } diff --git a/src/httpd_dacp.c b/src/httpd_dacp.c index ea21e039..24f10e58 100644 --- a/src/httpd_dacp.c +++ b/src/httpd_dacp.c @@ -719,12 +719,12 @@ playstatusupdate_cb(int fd, short what, void *arg) /* Thread: player */ static void -dacp_playstatus_update_handler(enum listener_event_type type) +dacp_playstatus_update_handler(short event_mask) { int ret; // Only send status update on player change events - if (type != LISTENER_PLAYER) + if (!(event_mask & LISTENER_PLAYER)) return; #ifdef HAVE_EVENTFD diff --git a/src/httpd_streaming.c b/src/httpd_streaming.c index c0e0e25b..52b6bfdb 100644 --- a/src/httpd_streaming.c +++ b/src/httpd_streaming.c @@ -185,7 +185,7 @@ streaming_send_cb(evutil_socket_t fd, short event, void *arg) // Thread: player (not fully thread safe, but hey...) static void -player_change_cb(enum listener_event_type type) +player_change_cb(short event_mask) { streaming_player_changed = 1; } diff --git a/src/inputs/pipe.c b/src/inputs/pipe.c index a0b513d2..3b1b4ff0 100644 --- a/src/inputs/pipe.c +++ b/src/inputs/pipe.c @@ -764,7 +764,7 @@ pipelist_create(void) // the pipe thread to watch the pipes. If no pipes in library, it will shut down // the pipe thread. static void -pipe_listener_cb(enum listener_event_type type) +pipe_listener_cb(short event_mask) { union pipe_arg *cmdarg; diff --git a/src/listener.h b/src/listener.h index f1aa65ca..1a3d55ad 100644 --- a/src/listener.h +++ b/src/listener.h @@ -28,18 +28,18 @@ enum listener_event_type LISTENER_LASTFM = (1 << 10), }; -typedef void (*notify)(enum listener_event_type type); +typedef void (*notify)(short event_mask); /* * Registers the given callback function to the given event types. * This function is not thread safe. Listeners must be added once at startup. * * @param notify_cb Callback function - * @param events Event mask, one or more of LISTENER_* + * @param event_mask Event mask, one or more of LISTENER_* * @return 0 on success, -1 on failure */ int -listener_add(notify notify_cb, short events); +listener_add(notify notify_cb, short event_mask); /* * Removes the given callback function diff --git a/src/mpd.c b/src/mpd.c index 8a5f793e..620b40f1 100644 --- a/src/mpd.c +++ b/src/mpd.c @@ -4768,12 +4768,12 @@ mpd_notify_idle_client(struct mpd_client_ctx *client_ctx, short events) static enum command_state mpd_notify_idle(void *arg, int *retval) { - enum listener_event_type type; + short event_mask; struct mpd_client_ctx *client; int i; - type = *(enum listener_event_type *)arg; - DPRINTF(E_DBG, L_MPD, "Notify clients waiting for idle results: %d\n", type); + event_mask = *(short *)arg; + DPRINTF(E_DBG, L_MPD, "Notify clients waiting for idle results: %d\n", event_mask); i = 0; client = mpd_clients; @@ -4781,7 +4781,7 @@ mpd_notify_idle(void *arg, int *retval) { DPRINTF(E_DBG, L_MPD, "Notify client #%d\n", i); - mpd_notify_idle_client(client, type); + mpd_notify_idle_client(client, event_mask); client = client->next; i++; } @@ -4791,14 +4791,14 @@ mpd_notify_idle(void *arg, int *retval) } static void -mpd_listener_cb(enum listener_event_type type) +mpd_listener_cb(short event_mask) { - enum listener_event_type *ptr; + short *ptr; - ptr = (enum listener_event_type *)malloc(sizeof(enum listener_event_type)); - *ptr = type; + ptr = (short *)malloc(sizeof(short)); + *ptr = event_mask; - DPRINTF(E_DBG, L_MPD, "Listener callback called with event type %d.\n", type); + DPRINTF(E_DBG, L_MPD, "Listener callback called with event type %d.\n", event_mask); commands_exec_async(cmdbase, mpd_notify_idle, ptr); } diff --git a/src/websocket.c b/src/websocket.c index bf323db0..44580663 100644 --- a/src/websocket.c +++ b/src/websocket.c @@ -50,10 +50,10 @@ static short write_events; /* Thread: library (the thread the event occurred) */ static void -listener_cb(enum listener_event_type type) +listener_cb(short event_mask) { // Add event to the event mask, clients will be notified at the next break of the libwebsockets service loop - events |= type; + events |= event_mask; } /*