aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-10-31 16:29:22 +0100
committerMax Kellermann <max@duempel.org>2008-10-31 16:29:22 +0100
commit86fbac54fd47dc21f3689d0efac207f3d6905927 (patch)
treeecd8d5285f199536e49d1bfa408f91664fe9d1c9 /src
parent78448fe1a517aa7734ae14a6959d3f7e0182308e (diff)
downloadmpd-86fbac54fd47dc21f3689d0efac207f3d6905927.tar.gz
mpd-86fbac54fd47dc21f3689d0efac207f3d6905927.tar.xz
mpd-86fbac54fd47dc21f3689d0efac207f3d6905927.zip
decoder: introduce switch statement in decoder_task()
switch looks much nicer than if/elseif/... and gcc generates nice warnings when a new command is added to the enum.
Diffstat (limited to 'src')
-rw-r--r--src/decoder_thread.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/decoder_thread.c b/src/decoder_thread.c
index e26e2e534..389634896 100644
--- a/src/decoder_thread.c
+++ b/src/decoder_thread.c
@@ -169,15 +169,21 @@ static void * decoder_task(mpd_unused void *arg)
while (1) {
assert(dc.state == DECODE_STATE_STOP);
- if (dc.command == DECODE_COMMAND_START ||
- dc.command == DECODE_COMMAND_SEEK) {
+ switch (dc.command) {
+ case DECODE_COMMAND_START:
+ case DECODE_COMMAND_SEEK:
decodeStart();
- } else if (dc.command == DECODE_COMMAND_STOP) {
+ break;
+
+ case DECODE_COMMAND_STOP:
dc.command = DECODE_COMMAND_NONE;
notify_signal(&pc.notify);
- } else {
+ break;
+
+ case DECODE_COMMAND_NONE:
notify_wait(&dc.notify);
notify_signal(&pc.notify);
+ break;
}
}