From f5050b1c40800c2daacf22db134d82bbf7c6c23b Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Thu, 17 Mar 2016 12:10:26 -0500 Subject: [PATCH] FS-8952: fix unreachable code and simplify conditions --- src/switch_core_codec.c | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/src/switch_core_codec.c b/src/switch_core_codec.c index a62ceee473..93750aabb6 100644 --- a/src/switch_core_codec.c +++ b/src/switch_core_codec.c @@ -319,11 +319,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_get_read_impl(switch_core_se if (session->read_impl.codec_id) { *impp = session->read_impl; return SWITCH_STATUS_SUCCESS; - } else { - memset(impp, 0, sizeof(*impp)); - impp->number_of_channels = 1; } + memset(impp, 0, sizeof(*impp)); + impp->number_of_channels = 1; return SWITCH_STATUS_FALSE; } @@ -332,11 +331,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_get_real_read_impl(switch_co if (session->real_read_impl.codec_id) { *impp = session->real_read_impl; return SWITCH_STATUS_SUCCESS; - } else { - return switch_core_session_get_read_impl(session, impp); } - return SWITCH_STATUS_FALSE; + return switch_core_session_get_read_impl(session, impp); } SWITCH_DECLARE(switch_status_t) switch_core_session_get_write_impl(switch_core_session_t *session, switch_codec_implementation_t *impp) @@ -344,11 +341,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_get_write_impl(switch_core_s if (session->write_impl.codec_id) { *impp = session->write_impl; return SWITCH_STATUS_SUCCESS; - } else { - memset(impp, 0, sizeof(*impp)); - impp->number_of_channels = 1; } - + + memset(impp, 0, sizeof(*impp)); + impp->number_of_channels = 1; return SWITCH_STATUS_FALSE; } @@ -357,11 +353,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_get_video_read_impl(switch_c if (session->video_read_impl.codec_id) { *impp = session->video_read_impl; return SWITCH_STATUS_SUCCESS; - } else { - memset(impp, 0, sizeof(*impp)); - impp->number_of_channels = 1; } + memset(impp, 0, sizeof(*impp)); + impp->number_of_channels = 1; return SWITCH_STATUS_FALSE; } @@ -370,11 +365,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_get_video_write_impl(switch_ if (session->video_write_impl.codec_id) { *impp = session->video_write_impl; return SWITCH_STATUS_SUCCESS; - } else { - memset(impp, 0, sizeof(*impp)); - impp->number_of_channels = 1; } + memset(impp, 0, sizeof(*impp)); + impp->number_of_channels = 1; return SWITCH_STATUS_FALSE; }