Commit 86fbac54 authored by Max Kellermann's avatar Max Kellermann

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.
parent 78448fe1
...@@ -169,15 +169,21 @@ static void * decoder_task(mpd_unused void *arg) ...@@ -169,15 +169,21 @@ static void * decoder_task(mpd_unused void *arg)
while (1) { while (1) {
assert(dc.state == DECODE_STATE_STOP); assert(dc.state == DECODE_STATE_STOP);
if (dc.command == DECODE_COMMAND_START || switch (dc.command) {
dc.command == DECODE_COMMAND_SEEK) { case DECODE_COMMAND_START:
case DECODE_COMMAND_SEEK:
decodeStart(); decodeStart();
} else if (dc.command == DECODE_COMMAND_STOP) { break;
case DECODE_COMMAND_STOP:
dc.command = DECODE_COMMAND_NONE; dc.command = DECODE_COMMAND_NONE;
notify_signal(&pc.notify); notify_signal(&pc.notify);
} else { break;
case DECODE_COMMAND_NONE:
notify_wait(&dc.notify); notify_wait(&dc.notify);
notify_signal(&pc.notify); notify_signal(&pc.notify);
break;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment