From ddf9803bbc797f2623cb0c99a14b5836d701a31b Mon Sep 17 00:00:00 2001 From: philippe44 Date: Sat, 3 Aug 2019 09:37:10 -0700 Subject: [PATCH] remove redundant "opened" flag in opus --- components/squeezelite/opus.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/components/squeezelite/opus.c b/components/squeezelite/opus.c index 5e5c45d0..8e36ee49 100644 --- a/components/squeezelite/opus.c +++ b/components/squeezelite/opus.c @@ -42,7 +42,6 @@ struct opus { struct OggOpusFile *of; - bool opened; #if FRAME_BUF u8_t *write_buf; #endif @@ -137,7 +136,6 @@ static decode_state opus_decompress(void) { return DECODE_COMPLETE; } - u->opened = true; info = OP(u, head, u->of, -1); LOCK_O; @@ -252,17 +250,17 @@ static void opus_open(u8_t size, u8_t rate, u8_t chan, u8_t endianness) { OP(u, free, u->of); u->of = NULL; } - u->opened = false; } static void opus_close(void) { - u->opened = false; - OP(u, free, u->of); + if (u->of) { + OP(u, free, u->of); + u->of = NULL; + } #if FRAME_BUF free(u->write_buf); u->write_buf = NULL; #endif - u->of = NULL; } static bool load_opus(void) {