From 0fe7efe735a55488e0c01232ef1b8fe9d4289ffc Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Tue, 18 Dec 2007 17:50:39 +0000 Subject: [PATCH] cleanups git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6869 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- libs/stfu/stfu.c | 4 +++- src/switch_ivr.c | 14 +++++++------- src/switch_ivr_originate.c | 4 ++-- src/switch_ivr_play_say.c | 14 +++++++------- 4 files changed, 19 insertions(+), 17 deletions(-) diff --git a/libs/stfu/stfu.c b/libs/stfu/stfu.c index 76d39e515e..81b494b8b4 100644 --- a/libs/stfu/stfu.c +++ b/libs/stfu/stfu.c @@ -81,7 +81,9 @@ stfu_instance_t *stfu_n_init(uint32_t qlen) struct stfu_instance *i; i = malloc(sizeof(*i)); - assert(i != NULL); + if (!i) { + return NULL; + } memset(i, 0, sizeof(*i)); stfu_n_init_aqueue(&i->a_queue, qlen); stfu_n_init_aqueue(&i->b_queue, qlen); diff --git a/src/switch_ivr.c b/src/switch_ivr.c index 280a6e2155..9e2622e41d 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -441,7 +441,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_park(switch_core_session_t *session, switch_byte_t decoded[SWITCH_RECOMMENDED_BUFFER_SIZE]; uint32_t rate = read_codec->implementation->actual_samples_per_second; uint32_t dlen = sizeof(decoded); - switch_status_t status; + switch_status_t tstatus; switch_byte_t *sendbuf = NULL; uint32_t sendlen = 0; @@ -452,9 +452,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_park(switch_core_session_t *session, status = SWITCH_STATUS_SUCCESS; } else { if (switch_test_flag(conninfo, SUF_NATIVE)) { - status = SWITCH_STATUS_NOOP; + tstatus = SWITCH_STATUS_NOOP; } else { - status = switch_core_codec_decode( + tstatus = switch_core_codec_decode( read_codec, &conninfo->read_codec, read_frame->data, @@ -462,17 +462,17 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_park(switch_core_session_t *session, read_codec->implementation->actual_samples_per_second, decoded, &dlen, &rate, &flags); } - switch (status) { + switch (tstatus) { case SWITCH_STATUS_NOOP: case SWITCH_STATUS_BREAK: sendbuf = read_frame->data; sendlen = read_frame->datalen; - status = SWITCH_STATUS_SUCCESS; + tstatus = SWITCH_STATUS_SUCCESS; break; case SWITCH_STATUS_SUCCESS: sendbuf = decoded; sendlen = dlen; - status = SWITCH_STATUS_SUCCESS; + tstatus = SWITCH_STATUS_SUCCESS; break; default: switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Codec Error\n"); @@ -481,7 +481,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_park(switch_core_session_t *session, } } - if (status == SWITCH_STATUS_SUCCESS) { + if (tstatus == SWITCH_STATUS_SUCCESS) { len = sendlen; if (switch_socket_sendto(conninfo->socket, conninfo->remote_addr, 0, (void *)sendbuf, &len) != SWITCH_STATUS_SUCCESS) { switch_ivr_deactivate_unicast(session); diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index c1c8a4282f..0e177e8acb 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -785,9 +785,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess /* read from the channel while we wait if the audio is up on it */ if (session && (ringback_data || !switch_channel_test_flag(caller_channel, CF_BYPASS_MEDIA)) && (switch_channel_test_flag(caller_channel, CF_ANSWERED) || switch_channel_test_flag(caller_channel, CF_EARLY_MEDIA))) { - switch_status_t status = switch_core_session_read_frame(session, &read_frame, 1000, 0); + switch_status_t tstatus = switch_core_session_read_frame(session, &read_frame, 1000, 0); - if (!SWITCH_READ_ACCEPTABLE(status)) { + if (!SWITCH_READ_ACCEPTABLE(tstatus)) { break; } diff --git a/src/switch_ivr_play_say.c b/src/switch_ivr_play_say.c index c67dde3757..254b4fe193 100644 --- a/src/switch_ivr_play_say.c +++ b/src/switch_ivr_play_say.c @@ -1063,13 +1063,13 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess } } else { /* time off the channel (if you must) */ switch_frame_t *read_frame; - switch_status_t status; + switch_status_t tstatus; while (switch_channel_ready(channel) && switch_channel_test_flag(channel, CF_HOLD)) { switch_yield(10000); } - status = switch_core_session_read_frame(session, &read_frame, -1, 0); + tstatus = switch_core_session_read_frame(session, &read_frame, -1, 0); - if (!SWITCH_READ_ACCEPTABLE(status)) { + if (!SWITCH_READ_ACCEPTABLE(tstatus)) { break; } @@ -1387,13 +1387,13 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text_handle(switch_core_session } } else { switch_frame_t *read_frame; - switch_status_t status = switch_core_session_read_frame(session, &read_frame, -1, 0); + switch_status_t tstatus = switch_core_session_read_frame(session, &read_frame, -1, 0); while (switch_channel_ready(channel) && switch_channel_test_flag(channel, CF_HOLD)) { switch_yield(10000); } - if (!SWITCH_READ_ACCEPTABLE(status)) { + if (!SWITCH_READ_ACCEPTABLE(tstatus)) { break; } @@ -1450,13 +1450,13 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text_handle(switch_core_session } } else { /* time off the channel (if you must) */ switch_frame_t *read_frame; - switch_status_t status = switch_core_session_read_frame(session, &read_frame, -1, 0); + switch_status_t tstatus = switch_core_session_read_frame(session, &read_frame, -1, 0); while (switch_channel_ready(channel) && switch_channel_test_flag(channel, CF_HOLD)) { switch_yield(10000); } - if (!SWITCH_READ_ACCEPTABLE(status)) { + if (!SWITCH_READ_ACCEPTABLE(tstatus)) { break; }