From 347e816247a75cbcc8c3c02f206f3c07005dc069 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 31 Oct 2008 16:29:24 +0100 Subject: [PATCH] decoder: reset state and command in decoder_task() Eliminate one goto in decodeStart() by moving some cleanup to decoder_task(). --- src/decoder_thread.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/decoder_thread.c b/src/decoder_thread.c index 389634896..822931a61 100644 --- a/src/decoder_thread.c +++ b/src/decoder_thread.c @@ -46,7 +46,7 @@ static void decodeStart(void) dc.current_song = dc.next_song; /* NEED LOCK */ if (!input_stream_open(&inStream, path_max_fs)) { dc.error = DECODE_ERROR_FILE; - goto stop_no_close; + return; } decoder.seeking = false; @@ -159,9 +159,6 @@ static void decodeStart(void) stop: if (close_instream) input_stream_close(&inStream); -stop_no_close: - dc.state = DECODE_STATE_STOP; - dc.command = DECODE_COMMAND_NONE; } static void * decoder_task(mpd_unused void *arg) @@ -173,6 +170,9 @@ static void * decoder_task(mpd_unused void *arg) case DECODE_COMMAND_START: case DECODE_COMMAND_SEEK: decodeStart(); + + dc.state = DECODE_STATE_STOP; + dc.command = DECODE_COMMAND_NONE; break; case DECODE_COMMAND_STOP: