]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Refactor if blocks
authorTravis Cross <tc@traviscross.com>
Wed, 30 Apr 2014 23:23:06 +0000 (23:23 +0000)
committerTravis Cross <tc@traviscross.com>
Wed, 30 Apr 2014 23:23:06 +0000 (23:23 +0000)
Since the first branch doesn't need to do anything, we invert it and
pull a sub-branch out a level into the main conditional.

src/switch_core_media.c

index a5cb29022c6589797f53e3f4d2167781f4d389d4..f007a8e3ee0bf7062e77a12d76fecc1bafd056fd 100644 (file)
@@ -3038,21 +3038,16 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
                switch_channel_set_variable(session->channel, "media_audio_mode", NULL);
        }
 
-
-       if (switch_media_handle_test_media_flag(smh, SCMF_DISABLE_HOLD) ||
-               ((val = switch_channel_get_variable(session->channel, "rtp_disable_hold")) && switch_true(val))) {
-       } else {
-
-               if (!smh->mparams->hold_laps) {
-                       smh->mparams->hold_laps++;
-                       if (switch_core_media_toggle_hold(session, sendonly)) {
-                               reneg = switch_media_handle_test_media_flag(smh, SCMF_RENEG_ON_HOLD);
-                               
-                               if ((val = switch_channel_get_variable(session->channel, "rtp_renegotiate_codec_on_hold"))) {
-                                       reneg = switch_true(val);
-                               }
+       if (!(switch_media_handle_test_media_flag(smh, SCMF_DISABLE_HOLD)
+                 || ((val = switch_channel_get_variable(session->channel, "rtp_disable_hold"))
+                         && switch_true(val)))
+               && !smh->mparams->hold_laps) {
+               smh->mparams->hold_laps++;
+               if (switch_core_media_toggle_hold(session, sendonly)) {
+                       reneg = switch_media_handle_test_media_flag(smh, SCMF_RENEG_ON_HOLD);
+                       if ((val = switch_channel_get_variable(session->channel, "rtp_renegotiate_codec_on_hold"))) {
+                               reneg = switch_true(val);
                        }
-                       
                }
        }