aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder_thread.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-10-31 16:29:45 +0100
committerMax Kellermann <max@duempel.org>2008-10-31 16:29:45 +0100
commitf098db149eab679bd71ef597713c3a22a75cc0fa (patch)
treefa5a77477340ced2c61edb8bbeebfc61b2d0fb61 /src/decoder_thread.c
parenta1ca32168c380f4f3e92517e215e92fdd8a9dc66 (diff)
downloadmpd-f098db149eab679bd71ef597713c3a22a75cc0fa.tar.gz
mpd-f098db149eab679bd71ef597713c3a22a75cc0fa.tar.xz
mpd-f098db149eab679bd71ef597713c3a22a75cc0fa.zip
decoder: eliminate gotos in decodeStart()
http://xkcd.com/292/
Diffstat (limited to 'src/decoder_thread.c')
-rw-r--r--src/decoder_thread.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/decoder_thread.c b/src/decoder_thread.c
index 92bcba5ba..0e9633292 100644
--- a/src/decoder_thread.c
+++ b/src/decoder_thread.c
@@ -59,19 +59,25 @@ static void decodeStart(void)
will be available then */
while (!inStream.ready) {
- if (dc.command != DECODE_COMMAND_NONE)
- goto stop;
+ if (dc.command != DECODE_COMMAND_NONE) {
+ input_stream_close(&inStream);
+ return;
+ }
ret = input_stream_buffer(&inStream);
- if (ret < 0)
- goto stop;
+ if (ret < 0) {
+ input_stream_close(&inStream);
+ return;
+ }
}
/* for http streams, seekable is determined in input_stream_buffer */
dc.seekable = inStream.seekable;
- if (dc.command == DECODE_COMMAND_STOP)
- goto stop;
+ if (dc.command == DECODE_COMMAND_STOP) {
+ input_stream_close(&inStream);
+ return;
+ }
ret = false;
if (!song_is_file(song)) {
@@ -156,7 +162,6 @@ static void decodeStart(void)
: DECODE_ERROR_FILE;
}
-stop:
if (close_instream)
input_stream_close(&inStream);
}