From b5cbc933c90ce8d5e34a7bce3e7c500e41f6e243 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Mon, 12 Oct 2015 03:05:28 +0200 Subject: language specific done data --- apps/mixer.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'apps/mixer.c') diff --git a/apps/mixer.c b/apps/mixer.c index 78a0d29..50684ca 100644 --- a/apps/mixer.c +++ b/apps/mixer.c @@ -121,7 +121,6 @@ int mixer_init(mixer_t* x, const char* name, const char* device) x->name_ = name; x->output_ = NULL; - x->pfd_count_ = 0; slist_init(&(x->langs_), free_lang_entry); slist_init(&(x->tasks_), free_task_entry); int ret = snd_rawmidi_open(NULL, &(x->output_), device, SND_RAWMIDI_NONBLOCK); @@ -223,19 +222,18 @@ void mixer_print_tasks(mixer_t* x) int mixer_get_poll_fd_count(mixer_t* x) { - return (x->pfd_count_ = snd_rawmidi_poll_descriptors_count(x->output_)); + return snd_rawmidi_poll_descriptors_count(x->output_); } int mixer_get_poll_fds(mixer_t* x, struct pollfd *pfds, int npfds) { - if(slist_length(&(x->tasks_))) - return snd_rawmidi_poll_descriptors(x->output_, pfds, npfds); - else { + int ret = snd_rawmidi_poll_descriptors(x->output_, pfds, npfds); + if(!slist_length(&(x->tasks_))) { int i; - for(i = 0; i < x->pfd_count_; ++i) + for(i = 0; i < ret; ++i) pfds[i].fd = -1; } - return x->pfd_count_; + return ret; } int mixer_handle_revents(mixer_t* x, struct pollfd *pfds, int npfds) -- cgit v1.2.3