use switch_assert macro

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6661 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris 2007-12-11 19:23:57 +00:00
parent c09a93be1b
commit 55a194e54e
25 changed files with 309 additions and 309 deletions

View File

@ -126,7 +126,7 @@ SWITCH_DECLARE(void) switch_buffer_unlock(switch_buffer_t *buffer)
SWITCH_DECLARE(switch_size_t) switch_buffer_len(switch_buffer_t *buffer)
{
assert(buffer != NULL);
switch_assert(buffer != NULL);
return buffer->datalen;
@ -135,7 +135,7 @@ SWITCH_DECLARE(switch_size_t) switch_buffer_len(switch_buffer_t *buffer)
SWITCH_DECLARE(switch_size_t) switch_buffer_freespace(switch_buffer_t *buffer)
{
assert(buffer != NULL);
switch_assert(buffer != NULL);
if (switch_test_flag(buffer, SWITCH_BUFFER_FLAG_DYNAMIC)) {
if (buffer->max_len) {
@ -150,7 +150,7 @@ SWITCH_DECLARE(switch_size_t) switch_buffer_freespace(switch_buffer_t *buffer)
SWITCH_DECLARE(switch_size_t) switch_buffer_inuse(switch_buffer_t *buffer)
{
assert(buffer != NULL);
switch_assert(buffer != NULL);
return buffer->used;
}
@ -159,7 +159,7 @@ SWITCH_DECLARE(switch_size_t) switch_buffer_toss(switch_buffer_t *buffer, switch
{
switch_size_t reading = 0;
assert(buffer != NULL);
switch_assert(buffer != NULL);
if (buffer->used < 1) {
buffer->used = 0;
@ -202,8 +202,8 @@ SWITCH_DECLARE(switch_size_t) switch_buffer_read(switch_buffer_t *buffer, void *
{
switch_size_t reading = 0;
assert(buffer != NULL);
assert(data != NULL);
switch_assert(buffer != NULL);
switch_assert(data != NULL);
if (buffer->used < 1) {
@ -227,9 +227,9 @@ SWITCH_DECLARE(switch_size_t) switch_buffer_write(switch_buffer_t *buffer, const
{
switch_size_t freespace, actual_freespace;
assert(buffer != NULL);
assert(data != NULL);
assert(buffer->data != NULL);
switch_assert(buffer != NULL);
switch_assert(data != NULL);
switch_assert(buffer->data != NULL);
if (!datalen) {
return buffer->used;
@ -286,8 +286,8 @@ SWITCH_DECLARE(switch_size_t) switch_buffer_write(switch_buffer_t *buffer, const
SWITCH_DECLARE(void) switch_buffer_zero(switch_buffer_t *buffer)
{
assert(buffer != NULL);
assert(buffer->data != NULL);
switch_assert(buffer != NULL);
switch_assert(buffer->data != NULL);
buffer->used = 0;
buffer->actually_used = 0;

View File

@ -54,7 +54,7 @@ SWITCH_DECLARE(switch_caller_profile_t *) switch_caller_profile_new(switch_memor
switch_caller_profile_t *profile = NULL;
profile = switch_core_alloc(pool, sizeof(*profile));
assert(profile != NULL);
switch_assert(profile != NULL);
if (!context) {
context = "default";
@ -85,7 +85,7 @@ SWITCH_DECLARE(switch_caller_profile_t *) switch_caller_profile_dup(switch_memor
switch_caller_profile_t *profile = NULL;
profile = switch_core_alloc(pool, sizeof(*profile));
assert(profile != NULL);
switch_assert(profile != NULL);
profile_dup(tocopy->username, profile->username, pool);
profile_dup(tocopy->dialplan, profile->dialplan, pool);
@ -294,7 +294,7 @@ SWITCH_DECLARE(void) switch_caller_extension_add_application(switch_core_session
{
switch_caller_application_t *caller_application = NULL;
assert(session != NULL);
switch_assert(session != NULL);
if ((caller_application = switch_core_session_alloc(session, sizeof(switch_caller_application_t))) != 0) {
caller_application->application_name = switch_core_session_strdup(session, application_name);

View File

@ -156,7 +156,7 @@ SWITCH_DECLARE(switch_call_cause_t) switch_channel_str2cause(const char *str)
SWITCH_DECLARE(switch_call_cause_t) switch_channel_get_cause(switch_channel_t *channel)
{
assert(channel != NULL);
switch_assert(channel != NULL);
return channel->hangup_cause;
}
@ -164,7 +164,7 @@ SWITCH_DECLARE(switch_channel_timetable_t *) switch_channel_get_timetable(switch
{
switch_channel_timetable_t *times = NULL;
assert(channel != NULL);
switch_assert(channel != NULL);
if (channel->caller_profile) {
switch_mutex_lock(channel->profile_mutex);
times = channel->caller_profile->times;
@ -176,7 +176,7 @@ SWITCH_DECLARE(switch_channel_timetable_t *) switch_channel_get_timetable(switch
SWITCH_DECLARE(switch_status_t) switch_channel_alloc(switch_channel_t **channel, switch_memory_pool_t *pool)
{
assert(pool != NULL);
switch_assert(pool != NULL);
if (((*channel) = switch_core_alloc(pool, sizeof(switch_channel_t))) == 0) {
return SWITCH_STATUS_MEMERR;
@ -200,7 +200,7 @@ SWITCH_DECLARE(switch_size_t) switch_channel_has_dtmf(switch_channel_t *channel)
{
switch_size_t has;
assert(channel != NULL);
switch_assert(channel != NULL);
switch_mutex_lock(channel->dtmf_mutex);
has = switch_buffer_inuse(channel->dtmf_buffer);
switch_mutex_unlock(channel->dtmf_mutex);
@ -215,7 +215,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_queue_dtmf(switch_channel_t *chan
switch_size_t wr = 0;
const char *p;
assert(channel != NULL);
switch_assert(channel != NULL);
switch_mutex_lock(channel->dtmf_mutex);
@ -254,7 +254,7 @@ SWITCH_DECLARE(switch_size_t) switch_channel_dequeue_dtmf(switch_channel_t *chan
switch_size_t bytes;
switch_event_t *event;
assert(channel != NULL);
switch_assert(channel != NULL);
switch_mutex_lock(channel->dtmf_mutex);
if ((bytes = switch_buffer_read(channel->dtmf_buffer, dtmf, len)) > 0) {
@ -283,7 +283,7 @@ SWITCH_DECLARE(void) switch_channel_uninit(switch_channel_t *channel)
SWITCH_DECLARE(switch_status_t) switch_channel_init(switch_channel_t *channel, switch_core_session_t *session, switch_channel_state_t state,
uint32_t flags)
{
assert(channel != NULL);
switch_assert(channel != NULL);
channel->state = state;
channel->flags = flags;
channel->session = session;
@ -325,7 +325,7 @@ SWITCH_DECLARE(void) switch_channel_presence(switch_channel_t *channel, const ch
SWITCH_DECLARE(const char *) switch_channel_get_variable(switch_channel_t *channel, const char *varname)
{
const char *v = NULL;
assert(channel != NULL);
switch_assert(channel != NULL);
switch_mutex_lock(channel->profile_mutex);
if (!(v = switch_event_get_header(channel->variables, (char*)varname))) {
@ -352,7 +352,7 @@ SWITCH_DECLARE(const char *) switch_channel_get_variable(switch_channel_t *chann
SWITCH_DECLARE(void) switch_channel_variable_last(switch_channel_t *channel)
{
assert(channel != NULL);
switch_assert(channel != NULL);
if (!channel->vi) {
return;
}
@ -365,7 +365,7 @@ SWITCH_DECLARE(switch_event_header_t *) switch_channel_variable_first(switch_cha
{
switch_event_header_t *hi = NULL;
assert(channel != NULL);
switch_assert(channel != NULL);
switch_mutex_lock(channel->profile_mutex);
if ((hi = channel->variables->headers)) {
channel->vi = 1;
@ -379,7 +379,7 @@ SWITCH_DECLARE(switch_event_header_t *) switch_channel_variable_first(switch_cha
SWITCH_DECLARE(switch_status_t) switch_channel_set_private(switch_channel_t *channel, const char *key, const void *private_info)
{
assert(channel != NULL);
switch_assert(channel != NULL);
switch_core_hash_insert_locked(channel->private_hash, key, private_info, channel->profile_mutex);
return SWITCH_STATUS_SUCCESS;
}
@ -387,14 +387,14 @@ SWITCH_DECLARE(switch_status_t) switch_channel_set_private(switch_channel_t *cha
SWITCH_DECLARE(void *) switch_channel_get_private(switch_channel_t *channel, const char *key)
{
void *val;
assert(channel != NULL);
switch_assert(channel != NULL);
val = switch_core_hash_find_locked(channel->private_hash, key, channel->profile_mutex);
return val;
}
SWITCH_DECLARE(switch_status_t) switch_channel_set_name(switch_channel_t *channel, const char *name)
{
assert(channel != NULL);
switch_assert(channel != NULL);
channel->name = NULL;
if (name) {
char *uuid = switch_core_session_get_uuid(channel->session);
@ -408,13 +408,13 @@ SWITCH_DECLARE(switch_status_t) switch_channel_set_name(switch_channel_t *channe
SWITCH_DECLARE(char *) switch_channel_get_name(switch_channel_t *channel)
{
assert(channel != NULL);
switch_assert(channel != NULL);
return channel->name ? channel->name : "N/A";
}
SWITCH_DECLARE(switch_status_t) switch_channel_set_variable(switch_channel_t *channel, const char *varname, const char *value)
{
assert(channel != NULL);
switch_assert(channel != NULL);
if (!switch_strlen_zero(varname)) {
switch_mutex_lock(channel->profile_mutex);
@ -431,7 +431,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_set_variable(switch_channel_t *ch
SWITCH_DECLARE(int) switch_channel_test_flag(switch_channel_t *channel, switch_channel_flag_t flags)
{
assert(channel != NULL);
switch_assert(channel != NULL);
return switch_test_flag(channel, flags) ? 1 : 0;
}
@ -439,7 +439,7 @@ SWITCH_DECLARE(switch_bool_t) switch_channel_set_flag_partner(switch_channel_t *
{
const char *uuid;
assert(channel != NULL);
switch_assert(channel != NULL);
if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))) {
switch_core_session_t *session;
@ -457,7 +457,7 @@ SWITCH_DECLARE(switch_bool_t) switch_channel_clear_flag_partner(switch_channel_t
{
const char *uuid;
assert(channel != NULL);
switch_assert(channel != NULL);
if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))) {
switch_core_session_t *session;
@ -489,13 +489,13 @@ SWITCH_DECLARE(void) switch_channel_wait_for_state(switch_channel_t *channel, sw
SWITCH_DECLARE(void) switch_channel_set_flag(switch_channel_t *channel, switch_channel_flag_t flags)
{
assert(channel != NULL);
switch_assert(channel != NULL);
switch_set_flag_locked(channel, flags);
}
SWITCH_DECLARE(void) switch_channel_set_state_flag(switch_channel_t *channel, switch_channel_flag_t flags)
{
assert(channel != NULL);
switch_assert(channel != NULL);
switch_mutex_lock(channel->flag_mutex);
channel->state_flags |= flags;
@ -504,14 +504,14 @@ SWITCH_DECLARE(void) switch_channel_set_state_flag(switch_channel_t *channel, sw
SWITCH_DECLARE(void) switch_channel_clear_flag(switch_channel_t *channel, switch_channel_flag_t flags)
{
assert(channel != NULL);
switch_assert(channel != NULL);
switch_clear_flag_locked(channel, flags);
}
SWITCH_DECLARE(switch_channel_state_t) switch_channel_get_state(switch_channel_t *channel)
{
switch_channel_state_t state;
assert(channel != NULL);
switch_assert(channel != NULL);
switch_mutex_lock(channel->flag_mutex);
state = channel->state;
@ -523,7 +523,7 @@ SWITCH_DECLARE(switch_channel_state_t) switch_channel_get_state(switch_channel_t
SWITCH_DECLARE(switch_channel_state_t) switch_channel_get_running_state(switch_channel_t *channel)
{
switch_channel_state_t state;
assert(channel != NULL);
switch_assert(channel != NULL);
switch_mutex_lock(channel->flag_mutex);
state = channel->running_state;
@ -536,7 +536,7 @@ SWITCH_DECLARE(uint8_t) switch_channel_ready(switch_channel_t *channel)
{
uint8_t ret = 0;
assert(channel != NULL);
switch_assert(channel != NULL);
if (!channel->hangup_cause && channel->state > CS_RING && channel->state < CS_HANGUP && channel->state != CS_RESET &&
!switch_test_flag(channel, CF_TRANSFER)) {
@ -618,7 +618,7 @@ SWITCH_DECLARE(switch_channel_state_t) switch_channel_perform_set_state(switch_c
int ok = 0;
assert(channel != NULL);
switch_assert(channel != NULL);
switch_mutex_lock(channel->flag_mutex);
last_state = channel->state;
@ -800,7 +800,7 @@ SWITCH_DECLARE(switch_channel_state_t) switch_channel_perform_set_state(switch_c
/* we won't tolerate an invalid state change so we can make sure we are as robust as a nice cup of dark coffee! */
if (channel->state < CS_HANGUP) {
/* not cool lets crash this bad boy and figure out wtf is going on */
assert(0);
switch_assert(0);
}
}
done:
@ -869,7 +869,7 @@ SWITCH_DECLARE(void) switch_channel_event_set_data(switch_channel_t *channel, sw
vval = (char *) hi->value;
x++;
assert(vvar && vval);
switch_assert(vvar && vval);
snprintf(buf, sizeof(buf), "variable_%s", vvar);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, buf, "%s", vval);
@ -882,10 +882,10 @@ SWITCH_DECLARE(void) switch_channel_event_set_data(switch_channel_t *channel, sw
SWITCH_DECLARE(void) switch_channel_set_caller_profile(switch_channel_t *channel, switch_caller_profile_t *caller_profile)
{
char *uuid = NULL;
assert(channel != NULL);
assert(channel->session != NULL);
switch_assert(channel != NULL);
switch_assert(channel->session != NULL);
switch_mutex_lock(channel->profile_mutex);
assert(caller_profile != NULL);
switch_assert(caller_profile != NULL);
uuid = switch_core_session_get_uuid(channel->session);
@ -927,7 +927,7 @@ SWITCH_DECLARE(void) switch_channel_set_caller_profile(switch_channel_t *channel
SWITCH_DECLARE(switch_caller_profile_t *) switch_channel_get_caller_profile(switch_channel_t *channel)
{
switch_caller_profile_t *profile;
assert(channel != NULL);
switch_assert(channel != NULL);
switch_mutex_lock(channel->profile_mutex);
profile = channel->caller_profile;
switch_mutex_unlock(channel->profile_mutex);
@ -936,26 +936,26 @@ SWITCH_DECLARE(switch_caller_profile_t *) switch_channel_get_caller_profile(swit
SWITCH_DECLARE(void) switch_channel_set_originator_caller_profile(switch_channel_t *channel, switch_caller_profile_t *caller_profile)
{
assert(channel != NULL);
switch_assert(channel != NULL);
switch_mutex_lock(channel->profile_mutex);
if (channel->caller_profile) {
caller_profile->next = channel->caller_profile->originator_caller_profile;
channel->caller_profile->originator_caller_profile = caller_profile;
}
assert(channel->caller_profile->originator_caller_profile->next != channel->caller_profile->originator_caller_profile);
switch_assert(channel->caller_profile->originator_caller_profile->next != channel->caller_profile->originator_caller_profile);
switch_mutex_unlock(channel->profile_mutex);
}
SWITCH_DECLARE(void) switch_channel_set_originatee_caller_profile(switch_channel_t *channel, switch_caller_profile_t *caller_profile)
{
assert(channel != NULL);
switch_assert(channel != NULL);
switch_mutex_lock(channel->profile_mutex);
if (channel->caller_profile) {
caller_profile->next = channel->caller_profile->originatee_caller_profile;
channel->caller_profile->originatee_caller_profile = caller_profile;
}
assert(channel->caller_profile->originatee_caller_profile->next != channel->caller_profile->originatee_caller_profile);
switch_assert(channel->caller_profile->originatee_caller_profile->next != channel->caller_profile->originatee_caller_profile);
switch_mutex_unlock(channel->profile_mutex);
}
@ -963,7 +963,7 @@ SWITCH_DECLARE(void) switch_channel_set_originatee_caller_profile(switch_channel
SWITCH_DECLARE(switch_caller_profile_t *) switch_channel_get_originator_caller_profile(switch_channel_t *channel)
{
switch_caller_profile_t *profile = NULL;
assert(channel != NULL);
switch_assert(channel != NULL);
switch_mutex_lock(channel->profile_mutex);
if (channel->caller_profile) {
@ -977,7 +977,7 @@ SWITCH_DECLARE(switch_caller_profile_t *) switch_channel_get_originator_caller_p
SWITCH_DECLARE(switch_caller_profile_t *) switch_channel_get_originatee_caller_profile(switch_channel_t *channel)
{
switch_caller_profile_t *profile = NULL;
assert(channel != NULL);
switch_assert(channel != NULL);
switch_mutex_lock(channel->profile_mutex);
if (channel->caller_profile) {
@ -990,8 +990,8 @@ SWITCH_DECLARE(switch_caller_profile_t *) switch_channel_get_originatee_caller_p
SWITCH_DECLARE(char *) switch_channel_get_uuid(switch_channel_t *channel)
{
assert(channel != NULL);
assert(channel->session != NULL);
switch_assert(channel != NULL);
switch_assert(channel->session != NULL);
return switch_core_session_get_uuid(channel->session);
}
@ -999,7 +999,7 @@ SWITCH_DECLARE(int) switch_channel_add_state_handler(switch_channel_t *channel,
{
int x, index;
assert(channel != NULL);
switch_assert(channel != NULL);
switch_mutex_lock(channel->flag_mutex);
for (x = 0; x < SWITCH_MAX_STATE_HANDLERS; x++) {
if (channel->state_handlers[x] == state_handler) {
@ -1025,7 +1025,7 @@ SWITCH_DECLARE(const switch_state_handler_table_t *) switch_channel_get_state_ha
{
const switch_state_handler_table_t *h = NULL;
assert(channel != NULL);
switch_assert(channel != NULL);
if (index > SWITCH_MAX_STATE_HANDLERS || index > channel->state_handler_index) {
return NULL;
@ -1046,7 +1046,7 @@ SWITCH_DECLARE(void) switch_channel_clear_state_handler(switch_channel_t *channe
switch_mutex_lock(channel->flag_mutex);
assert(channel != NULL);
switch_assert(channel != NULL);
channel->state_handler_index = 0;
if (state_handler) {
@ -1072,7 +1072,7 @@ SWITCH_DECLARE(void) switch_channel_clear_state_handler(switch_channel_t *channe
SWITCH_DECLARE(void) switch_channel_set_caller_extension(switch_channel_t *channel, switch_caller_extension_t *caller_extension)
{
assert(channel != NULL);
switch_assert(channel != NULL);
switch_mutex_lock(channel->profile_mutex);
caller_extension->next = channel->caller_profile->caller_extension;
@ -1085,7 +1085,7 @@ SWITCH_DECLARE(switch_caller_extension_t *) switch_channel_get_caller_extension(
{
switch_caller_extension_t *extension = NULL;
assert(channel != NULL);
switch_assert(channel != NULL);
switch_mutex_lock(channel->profile_mutex);
if (channel->caller_profile) {
extension = channel->caller_profile->caller_extension;
@ -1098,7 +1098,7 @@ SWITCH_DECLARE(switch_caller_extension_t *) switch_channel_get_caller_extension(
SWITCH_DECLARE(switch_channel_state_t) switch_channel_perform_hangup(switch_channel_t *channel,
const char *file, const char *func, int line, switch_call_cause_t hangup_cause)
{
assert(channel != NULL);
switch_assert(channel != NULL);
switch_mutex_lock(channel->flag_mutex);
if (channel->caller_profile && channel->caller_profile->times && !channel->caller_profile->times->hungup) {
@ -1182,7 +1182,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_pre_answer(switch_channel
switch_core_session_message_t msg;
switch_status_t status;
assert(channel != NULL);
switch_assert(channel != NULL);
if (channel->hangup_cause || channel->state >= CS_HANGUP) {
return SWITCH_STATUS_FALSE;
@ -1212,7 +1212,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_ring_ready(switch_channel
switch_core_session_message_t msg;
switch_status_t status;
assert(channel != NULL);
switch_assert(channel != NULL);
if (channel->hangup_cause || channel->state >= CS_HANGUP) {
return SWITCH_STATUS_FALSE;
@ -1243,7 +1243,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_answered(switch_chan
const char *uuid;
switch_core_session_t *other_session;
assert(channel != NULL);
switch_assert(channel != NULL);
if (channel->hangup_cause || channel->state >= CS_HANGUP) {
return SWITCH_STATUS_FALSE;
@ -1286,7 +1286,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_answer(switch_channel_t *
switch_core_session_message_t msg;
switch_status_t status;
assert(channel != NULL);
switch_assert(channel != NULL);
if (channel->hangup_cause || channel->state >= CS_HANGUP) {
return SWITCH_STATUS_FALSE;
@ -1471,7 +1471,7 @@ SWITCH_DECLARE(char *) switch_channel_expand_variables(switch_channel_t *channel
sub_val = switch_channel_get_variable(channel, vname);
if (offset || ooffset) {
cloned_sub_val = strdup(sub_val);
assert(cloned_sub_val);
switch_assert(cloned_sub_val);
sub_val = cloned_sub_val;
}
@ -1583,13 +1583,13 @@ SWITCH_DECLARE(char *) switch_channel_build_param_string(switch_channel_t *chann
}
encode_buf = malloc(encode_len);
assert(encode_buf);
switch_assert(encode_buf);
if (!caller_profile) {
caller_profile = switch_channel_get_caller_profile(channel);
}
assert(caller_profile != NULL);
switch_assert(caller_profile != NULL);
prof[0] = caller_profile->context;
prof[1] = caller_profile->destination_number;
@ -1647,7 +1647,7 @@ SWITCH_DECLARE(char *) switch_channel_build_param_string(switch_channel_t *chann
encode_len = new_len;
tmp = realloc(encode_buf, encode_len);
assert(tmp);
switch_assert(tmp);
encode_buf = tmp;
}

View File

@ -182,10 +182,10 @@ static void *switch_core_service_thread(switch_thread_t * thread, void *obj)
switch_frame_t *read_frame;
int stream_id = *stream_id_p;
assert(thread != NULL);
assert(session != NULL);
switch_assert(thread != NULL);
switch_assert(session != NULL);
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
switch_assert(channel != NULL);
switch_channel_set_flag(channel, CF_SERVICE);
while (data->running > 0) {
@ -568,8 +568,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_mime_add_type(const char *type, cons
const char *check = (const char *) switch_core_hash_find(runtime.mime_types, ext);
switch_status_t status = SWITCH_STATUS_FALSE;
assert(type);
assert(ext);
switch_assert(type);
switch_assert(ext);
if (!check) {
char *ptype = switch_core_permanent_strdup(type);
@ -578,7 +578,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_mime_add_type(const char *type, cons
char *argv[20] = { 0 };
int x;
assert(ext_list);
switch_assert(ext_list);
if ((argc = switch_separate_string(ext_list, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
@ -603,7 +603,7 @@ static void load_mime_types(void)
char *mime_path = NULL;
mime_path = switch_mprintf("%s/%s", SWITCH_GLOBAL_dirs.conf_dir, cf);
assert(mime_path);
switch_assert(mime_path);
fd = open(mime_path, O_RDONLY);
if (fd <= 0) {
@ -664,7 +664,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc
*err = "FATAL ERROR! Could noat allocate memory pool\n";
return SWITCH_STATUS_MEMERR;
}
assert(runtime.memory_pool != NULL);
switch_assert(runtime.memory_pool != NULL);
switch_mutex_init(&runtime.throttle_mutex, SWITCH_MUTEX_NESTED, runtime.memory_pool);
switch_core_set_globals();
switch_core_session_init(runtime.memory_pool);
@ -750,7 +750,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc
runtime.console = stdout;
}
assert(runtime.memory_pool != NULL);
switch_assert(runtime.memory_pool != NULL);
switch_log_init(runtime.memory_pool);
switch_event_init(runtime.memory_pool);

View File

@ -54,7 +54,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_asr_open(switch_asr_handle_t *ah,
}
}
assert(ah != NULL);
switch_assert(ah != NULL);
if ((ah->asr_interface = switch_loadable_module_get_asr_interface(module_name)) == 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "invalid asr module [%s]!\n", module_name);
@ -86,7 +86,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_asr_load_grammar(switch_asr_handle_t
char *epath = NULL;
switch_status_t status;
assert(ah != NULL);
switch_assert(ah != NULL);
if (!switch_is_file_path(path)) {
epath = switch_mprintf("%s%s%s", SWITCH_GLOBAL_dirs.grammar_dir, SWITCH_PATH_SEPARATOR, path);
@ -103,7 +103,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_asr_unload_grammar(switch_asr_handle
{
switch_status_t status;
assert(ah != NULL);
switch_assert(ah != NULL);
status = ah->asr_interface->asr_unload_grammar(ah, grammar);
return status;
@ -111,42 +111,42 @@ SWITCH_DECLARE(switch_status_t) switch_core_asr_unload_grammar(switch_asr_handle
SWITCH_DECLARE(switch_status_t) switch_core_asr_pause(switch_asr_handle_t *ah)
{
assert(ah != NULL);
switch_assert(ah != NULL);
return ah->asr_interface->asr_pause(ah);
}
SWITCH_DECLARE(switch_status_t) switch_core_asr_resume(switch_asr_handle_t *ah)
{
assert(ah != NULL);
switch_assert(ah != NULL);
return ah->asr_interface->asr_resume(ah);
}
SWITCH_DECLARE(switch_status_t) switch_core_asr_close(switch_asr_handle_t *ah, switch_asr_flag_t *flags)
{
assert(ah != NULL);
switch_assert(ah != NULL);
return ah->asr_interface->asr_close(ah, flags);
}
SWITCH_DECLARE(switch_status_t) switch_core_asr_feed(switch_asr_handle_t *ah, void *data, unsigned int len, switch_asr_flag_t *flags)
{
assert(ah != NULL);
switch_assert(ah != NULL);
return ah->asr_interface->asr_feed(ah, data, len, flags);
}
SWITCH_DECLARE(switch_status_t) switch_core_asr_check_results(switch_asr_handle_t *ah, switch_asr_flag_t *flags)
{
assert(ah != NULL);
switch_assert(ah != NULL);
return ah->asr_interface->asr_check_results(ah, flags);
}
SWITCH_DECLARE(switch_status_t) switch_core_asr_get_results(switch_asr_handle_t *ah, char **xmlstr, switch_asr_flag_t *flags)
{
assert(ah != NULL);
switch_assert(ah != NULL);
return ah->asr_interface->asr_get_results(ah, xmlstr, flags);
}

View File

@ -40,7 +40,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_set_read_codec(switch_core_s
switch_channel_t *channel;
char tmp[30];
assert(session != NULL);
switch_assert(session != NULL);
channel = switch_core_session_get_channel(session);
if (switch_event_create(&event, SWITCH_EVENT_CODEC) == SWITCH_STATUS_SUCCESS) {
@ -77,7 +77,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_set_write_codec(switch_core_
switch_channel_t *channel;
char tmp[30];
assert(session != NULL);
switch_assert(session != NULL);
channel = switch_core_session_get_channel(session);
@ -112,8 +112,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_init(switch_codec_t *codec, ch
const switch_codec_implementation_t *iptr, *implementation = NULL;
char *mode = fmtp;
assert(codec != NULL);
assert(codec_name != NULL);
switch_assert(codec != NULL);
switch_assert(codec_name != NULL);
memset(codec, 0, sizeof(*codec));
@ -199,9 +199,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_encode(switch_codec_t *codec,
uint32_t decoded_rate,
void *encoded_data, uint32_t * encoded_data_len, uint32_t * encoded_rate, unsigned int *flag)
{
assert(codec != NULL);
assert(encoded_data != NULL);
assert(decoded_data != NULL);
switch_assert(codec != NULL);
switch_assert(encoded_data != NULL);
switch_assert(decoded_data != NULL);
if (!codec->implementation) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Codec is not initilized!\n");
@ -227,9 +227,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_decode(switch_codec_t *codec,
void *decoded_data, uint32_t * decoded_data_len, uint32_t * decoded_rate, unsigned int *flag)
{
assert(codec != NULL);
assert(encoded_data != NULL);
assert(decoded_data != NULL);
switch_assert(codec != NULL);
switch_assert(encoded_data != NULL);
switch_assert(decoded_data != NULL);
@ -251,7 +251,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_decode(switch_codec_t *codec,
SWITCH_DECLARE(switch_status_t) switch_core_codec_destroy(switch_codec_t *codec)
{
assert(codec != NULL);
switch_assert(codec != NULL);
if (!codec->implementation) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Codec is not initilized!\n");

View File

@ -94,16 +94,16 @@ SWITCH_DECLARE(switch_status_t) switch_core_file_open(switch_file_handle_t *fh,
SWITCH_DECLARE(switch_status_t) switch_core_file_read(switch_file_handle_t *fh, void *data, switch_size_t *len)
{
assert(fh != NULL);
assert(fh->file_interface != NULL);
switch_assert(fh != NULL);
switch_assert(fh->file_interface != NULL);
return fh->file_interface->file_read(fh, data, len);
}
SWITCH_DECLARE(switch_status_t) switch_core_file_write(switch_file_handle_t *fh, void *data, switch_size_t *len)
{
assert(fh != NULL);
assert(fh->file_interface != NULL);
switch_assert(fh != NULL);
switch_assert(fh->file_interface != NULL);
return fh->file_interface->file_write(fh, data, len);
}
@ -112,8 +112,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_file_seek(switch_file_handle_t *fh,
{
switch_status_t status;
assert(fh != NULL);
assert(fh->file_interface != NULL);
switch_assert(fh != NULL);
switch_assert(fh->file_interface != NULL);
switch_set_flag(fh, SWITCH_FILE_SEEK);
status = fh->file_interface->file_seek(fh, cur_pos, samples, whence);
@ -125,16 +125,16 @@ SWITCH_DECLARE(switch_status_t) switch_core_file_seek(switch_file_handle_t *fh,
SWITCH_DECLARE(switch_status_t) switch_core_file_set_string(switch_file_handle_t *fh, switch_audio_col_t col, const char *string)
{
assert(fh != NULL);
assert(fh->file_interface != NULL);
switch_assert(fh != NULL);
switch_assert(fh->file_interface != NULL);
return fh->file_interface->file_set_string(fh, col, string);
}
SWITCH_DECLARE(switch_status_t) switch_core_file_get_string(switch_file_handle_t *fh, switch_audio_col_t col, const char **string)
{
assert(fh != NULL);
assert(fh->file_interface != NULL);
switch_assert(fh != NULL);
switch_assert(fh->file_interface != NULL);
return fh->file_interface->file_get_string(fh, col, string);
@ -143,8 +143,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_file_get_string(switch_file_handle_t
SWITCH_DECLARE(switch_status_t) switch_core_file_close(switch_file_handle_t *fh)
{
assert(fh != NULL);
assert(fh->file_interface != NULL);
switch_assert(fh != NULL);
switch_assert(fh->file_interface != NULL);
switch_clear_flag(fh, SWITCH_FILE_OPEN);
return fh->file_interface->file_close(fh);

View File

@ -47,7 +47,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_hash_init(switch_hash_t ** hash, swi
switch_hash_t *newhash;
newhash = switch_core_alloc(pool, sizeof(*newhash));
assert(newhash);
switch_assert(newhash);
sqlite3HashInit(&newhash->table, SQLITE_HASH_STRING, 1);
*hash = newhash;
@ -58,7 +58,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_hash_init(switch_hash_t ** hash, swi
SWITCH_DECLARE(switch_status_t) switch_core_hash_destroy(switch_hash_t **hash)
{
assert(hash != NULL && *hash != NULL);
switch_assert(hash != NULL && *hash != NULL);
sqlite3HashClear(&(*hash)->table);
*hash = NULL;
return SWITCH_STATUS_SUCCESS;

View File

@ -76,8 +76,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_video_frame(switch_core
goto done;
}
assert(session != NULL);
assert(*frame != NULL);
switch_assert(session != NULL);
switch_assert(*frame != NULL);
if (switch_test_flag(*frame, SFF_CNG)) {
status = SWITCH_STATUS_SUCCESS;
@ -101,7 +101,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
status = SWITCH_STATUS_FALSE;
need_codec = perfect = 0;
assert(session != NULL);
switch_assert(session != NULL);
*frame = NULL;
if (switch_channel_test_flag(session->channel, CF_HOLD)) {
@ -128,8 +128,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
goto done;
}
assert(session != NULL);
assert(*frame != NULL);
switch_assert(session != NULL);
switch_assert(*frame != NULL);
if (switch_test_flag(*frame, SFF_CNG)) {
@ -137,7 +137,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
goto done;
}
assert((*frame)->codec != NULL);
switch_assert((*frame)->codec != NULL);
if ((session->read_codec && (*frame)->codec && session->read_codec->implementation != (*frame)->codec->implementation)) {
need_codec = TRUE;
}
@ -313,9 +313,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
}
session->enc_read_frame.datalen = session->enc_read_frame.buflen;
assert(session->read_codec != NULL);
assert(enc_frame != NULL);
assert(enc_frame->data != NULL);
switch_assert(session->read_codec != NULL);
switch_assert(enc_frame != NULL);
switch_assert(enc_frame->data != NULL);
status = switch_core_codec_encode(session->read_codec,
enc_frame->codec,
@ -433,8 +433,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess
unsigned int flag = 0, need_codec = 0, perfect = 0, do_bugs = 0, do_write = 0, do_resample = 0;
switch_io_flag_t io_flag = SWITCH_IO_FLAG_NOOP;
assert(session != NULL);
assert(frame != NULL);
switch_assert(session != NULL);
switch_assert(frame != NULL);
if (switch_channel_test_flag(session->channel, CF_HOLD)) {
@ -450,7 +450,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess
return SWITCH_STATUS_SUCCESS;
}
assert(frame->codec != NULL);
switch_assert(frame->codec != NULL);
if ((session->write_codec && frame->codec && session->write_codec->implementation != frame->codec->implementation)) {
need_codec = TRUE;

View File

@ -45,8 +45,8 @@ static struct {
SWITCH_DECLARE(switch_memory_pool_t *) switch_core_session_get_pool(switch_core_session_t *session)
{
assert(session != NULL);
assert(session->pool != NULL);
switch_assert(session != NULL);
switch_assert(session->pool != NULL);
return session->pool;
}
@ -55,8 +55,8 @@ SWITCH_DECLARE(switch_memory_pool_t *) switch_core_session_get_pool(switch_core_
SWITCH_DECLARE(void *) switch_core_session_alloc(switch_core_session_t *session, switch_size_t memory)
{
void *ptr = NULL;
assert(session != NULL);
assert(session->pool != NULL);
switch_assert(session != NULL);
switch_assert(session->pool != NULL);
#ifdef LOCK_MORE
switch_mutex_lock(memory_manager.mem_lock);
@ -67,7 +67,7 @@ SWITCH_DECLARE(void *) switch_core_session_alloc(switch_core_session_t *session,
#endif
ptr = apr_palloc(session->pool, memory);
assert(ptr != NULL);
switch_assert(ptr != NULL);
memset(ptr, 0, memory);
@ -84,7 +84,7 @@ SWITCH_DECLARE(void *) switch_core_session_alloc(switch_core_session_t *session,
SWITCH_DECLARE(void *) switch_core_permanent_alloc(switch_size_t memory)
{
void *ptr = NULL;
assert(memory_manager.memory_pool != NULL);
switch_assert(memory_manager.memory_pool != NULL);
#ifdef LOCK_MORE
switch_mutex_lock(memory_manager.mem_lock);
@ -96,7 +96,7 @@ SWITCH_DECLARE(void *) switch_core_permanent_alloc(switch_size_t memory)
ptr = apr_palloc(memory_manager.memory_pool, memory);
assert(ptr != NULL);
switch_assert(ptr != NULL);
memset(ptr, 0, memory);
#ifdef LOCK_MORE
@ -110,7 +110,7 @@ SWITCH_DECLARE(char *) switch_core_permanent_strdup(const char *todup)
{
char *duped = NULL;
switch_size_t len;
assert(memory_manager.memory_pool != NULL);
switch_assert(memory_manager.memory_pool != NULL);
if (!todup)
return NULL;
@ -121,7 +121,7 @@ SWITCH_DECLARE(char *) switch_core_permanent_strdup(const char *todup)
len = strlen(todup) + 1;
duped = apr_pstrmemdup(memory_manager.memory_pool, todup, len);
assert(duped != NULL);
switch_assert(duped != NULL);
#ifdef DEBUG_ALLOC
printf("Perm Allocate %d\n", (int)len);
@ -143,12 +143,12 @@ SWITCH_DECLARE(char *) switch_core_session_sprintf(switch_core_session_t *sessio
switch_mutex_lock(memory_manager.mem_lock);
#endif
assert(session != NULL);
assert(session->pool != NULL);
switch_assert(session != NULL);
switch_assert(session->pool != NULL);
va_start(ap, fmt);
result = apr_pvsprintf(session->pool, fmt, ap);
assert(result != NULL);
switch_assert(result != NULL);
va_end(ap);
@ -164,7 +164,7 @@ SWITCH_DECLARE(char *) switch_core_sprintf(switch_memory_pool_t *pool, const cha
va_list ap;
char *result = NULL;
assert(pool != NULL);
switch_assert(pool != NULL);
#ifdef LOCK_MORE
switch_mutex_lock(memory_manager.mem_lock);
@ -173,7 +173,7 @@ SWITCH_DECLARE(char *) switch_core_sprintf(switch_memory_pool_t *pool, const cha
va_start(ap, fmt);
result = apr_pvsprintf(pool, fmt, ap);
assert(result != NULL);
switch_assert(result != NULL);
va_end(ap);
#ifdef LOCK_MORE
@ -188,8 +188,8 @@ SWITCH_DECLARE(char *) switch_core_session_strdup(switch_core_session_t *session
{
char *duped = NULL;
switch_size_t len;
assert(session != NULL);
assert(session->pool != NULL);
switch_assert(session != NULL);
switch_assert(session->pool != NULL);
if (!todup) {
return NULL;
@ -206,7 +206,7 @@ SWITCH_DECLARE(char *) switch_core_session_strdup(switch_core_session_t *session
#endif
duped = apr_pstrmemdup(session->pool, todup, len);
assert(duped != NULL);
switch_assert(duped != NULL);
#ifdef LOCK_MORE
@ -221,7 +221,7 @@ SWITCH_DECLARE(char *) switch_core_strdup(switch_memory_pool_t *pool, const char
{
char *duped = NULL;
switch_size_t len;
assert(pool != NULL);
switch_assert(pool != NULL);
if (!todup) {
return NULL;
@ -238,7 +238,7 @@ SWITCH_DECLARE(char *) switch_core_strdup(switch_memory_pool_t *pool, const char
#endif
duped = apr_pstrmemdup(pool, todup, len);
assert(duped != NULL);
switch_assert(duped != NULL);
#ifdef LOCK_MORE
switch_mutex_unlock(memory_manager.mem_lock);
@ -253,13 +253,13 @@ SWITCH_DECLARE(switch_status_t) switch_core_perform_new_memory_pool(switch_memor
void *pop;
switch_mutex_lock(memory_manager.mem_lock);
assert(pool != NULL);
switch_assert(pool != NULL);
if (switch_queue_trypop(memory_manager.pool_recycle_queue, &pop) == SWITCH_STATUS_SUCCESS) {
*pool = (switch_memory_pool_t *) pop;
} else {
apr_pool_create(pool, NULL);
assert(*pool != NULL);
switch_assert(*pool != NULL);
}
#ifdef DEBUG_ALLOC2
@ -276,7 +276,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_perform_destroy_memory_pool(switch_m
//char tmp[128] = "";
assert(pool != NULL);
switch_assert(pool != NULL);
#ifdef DEBUG_ALLOC2
printf("Free Pool %s %s:%d\n", file, func, line);
@ -296,7 +296,7 @@ SWITCH_DECLARE(void *) switch_core_alloc(switch_memory_pool_t *pool, switch_size
{
void *ptr = NULL;
assert(pool != NULL);
switch_assert(pool != NULL);
#ifdef LOCK_MORE
switch_mutex_lock(memory_manager.mem_lock);
@ -304,11 +304,11 @@ SWITCH_DECLARE(void *) switch_core_alloc(switch_memory_pool_t *pool, switch_size
#ifdef DEBUG_ALLOC
printf("Allocate %d\n", (int)memory);
/*assert(memory < 20000);*/
/*switch_assert(memory < 20000);*/
#endif
ptr = apr_palloc(pool, memory);
assert(ptr != NULL);
switch_assert(ptr != NULL);
memset(ptr, 0, memory);
@ -413,7 +413,7 @@ switch_memory_pool_t *switch_core_memory_init(void)
memset(&memory_manager, 0, sizeof(memory_manager));
apr_pool_create(&memory_manager.memory_pool, NULL);
assert(memory_manager.memory_pool != NULL);
switch_assert(memory_manager.memory_pool != NULL);
switch_mutex_init(&memory_manager.mem_lock, SWITCH_MUTEX_NESTED, memory_manager.memory_pool);
switch_queue_create(&memory_manager.pool_queue, 50000, memory_manager.memory_pool);
switch_queue_create(&memory_manager.pool_recycle_queue, 50000, memory_manager.memory_pool);

View File

@ -144,14 +144,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_event_send(char *uuid_str, s
SWITCH_DECLARE(void *) switch_core_session_get_private(switch_core_session_t *session)
{
assert(session != NULL);
switch_assert(session != NULL);
return session->private_info;
}
SWITCH_DECLARE(switch_status_t) switch_core_session_set_private(switch_core_session_t *session, void *private_info)
{
assert(session != NULL);
switch_assert(session != NULL);
session->private_info = private_info;
return SWITCH_STATUS_SUCCESS;
}
@ -231,7 +231,7 @@ SWITCH_DECLARE(switch_call_cause_t) switch_core_session_outgoing_channel(switch_
return SWITCH_CAUSE_CHAN_NOT_IMPLEMENTED;
}
assert(*new_session != NULL);
switch_assert(*new_session != NULL);
if (*new_session) {
switch_caller_profile_t *profile = NULL, *peer_profile = NULL, *cloned_profile = NULL;
@ -321,7 +321,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_receive_message(switch_core_
switch_io_event_hook_receive_message_t *ptr;
switch_status_t status = SWITCH_STATUS_SUCCESS;
assert(session != NULL);
switch_assert(session != NULL);
if (session->endpoint_interface->io_routines->receive_message) {
status = session->endpoint_interface->io_routines->receive_message(session, message);
@ -348,10 +348,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_pass_indication(switch_core_
switch_channel_t *channel;
switch_status_t status = SWITCH_STATUS_SUCCESS;
assert(session != NULL);
switch_assert(session != NULL);
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
switch_assert(channel != NULL);
if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) && (other_session = switch_core_session_locate(uuid))) {
msg.message_id = indication;
@ -385,7 +385,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_queue_message(switch_core_se
{
switch_status_t status = SWITCH_STATUS_FALSE;
assert(session != NULL);
switch_assert(session != NULL);
if (session->message_queue) {
if (switch_queue_trypush(session->message_queue, message) == SWITCH_STATUS_SUCCESS) {
@ -401,7 +401,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_dequeue_message(switch_core_
switch_status_t status = SWITCH_STATUS_FALSE;
void *pop;
assert(session != NULL);
switch_assert(session != NULL);
if (session->message_queue) {
if ((status = (switch_status_t) switch_queue_trypop(session->message_queue, &pop)) == SWITCH_STATUS_SUCCESS) {
@ -433,7 +433,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_receive_event(switch_core_se
switch_io_event_hook_receive_event_t *ptr;
switch_status_t status = SWITCH_STATUS_FALSE;
assert(session != NULL);
switch_assert(session != NULL);
/* Acquire a read lock on the session or forget it the channel is dead */
if (switch_core_session_read_lock(session) == SWITCH_STATUS_SUCCESS) {
@ -470,7 +470,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_queue_event(switch_core_sess
{
switch_status_t status = SWITCH_STATUS_FALSE;
assert(session != NULL);
switch_assert(session != NULL);
if (session->event_queue) {
if (switch_queue_trypush(session->event_queue, *event) == SWITCH_STATUS_SUCCESS) {
@ -496,7 +496,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_dequeue_event(switch_core_se
switch_status_t status = SWITCH_STATUS_FALSE;
void *pop;
assert(session != NULL);
switch_assert(session != NULL);
if (session->event_queue) {
if ((status = (switch_status_t) switch_queue_trypop(session->event_queue, &pop)) == SWITCH_STATUS_SUCCESS) {
@ -511,7 +511,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_queue_private_event(switch_c
{
switch_status_t status = SWITCH_STATUS_FALSE;
assert(session != NULL);
switch_assert(session != NULL);
if (session->private_event_queue) {
(*event)->event_id = SWITCH_EVENT_PRIVATE_COMMAND;
@ -540,10 +540,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_dequeue_private_event(switch
void *pop;
switch_channel_t *channel;
assert(session != NULL);
switch_assert(session != NULL);
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
switch_assert(channel != NULL);
if (switch_channel_test_flag(channel, CF_EVENT_LOCK)) {
@ -849,8 +849,8 @@ SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_by_name(char
SWITCH_DECLARE(uint8_t) switch_core_session_compare(switch_core_session_t *a, switch_core_session_t *b)
{
assert(a != NULL);
assert(b != NULL);
switch_assert(a != NULL);
switch_assert(b != NULL);
return (uint8_t) (a->endpoint_interface == b->endpoint_interface);
}
@ -911,7 +911,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_exec(switch_core_session_t *
log = switch_core_session_alloc(session, sizeof(*log));
assert(log != NULL);
switch_assert(log != NULL);
log->app = switch_core_session_strdup(session, application_interface->interface_name);
log->arg = switch_core_session_strdup(session, arg);

View File

@ -87,14 +87,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_speech_open(switch_speech_handle_t *
SWITCH_DECLARE(switch_status_t) switch_core_speech_feed_tts(switch_speech_handle_t *sh, char *text, switch_speech_flag_t *flags)
{
assert(sh != NULL);
switch_assert(sh != NULL);
return sh->speech_interface->speech_feed_tts(sh, text, flags);
}
SWITCH_DECLARE(void) switch_core_speech_flush_tts(switch_speech_handle_t *sh)
{
assert(sh != NULL);
switch_assert(sh != NULL);
if (sh->speech_interface->speech_flush_tts) {
sh->speech_interface->speech_flush_tts(sh);
@ -103,7 +103,7 @@ SWITCH_DECLARE(void) switch_core_speech_flush_tts(switch_speech_handle_t *sh)
SWITCH_DECLARE(void) switch_core_speech_text_param_tts(switch_speech_handle_t *sh, char *param, const char *val)
{
assert(sh != NULL);
switch_assert(sh != NULL);
if (sh->speech_interface->speech_text_param_tts) {
sh->speech_interface->speech_text_param_tts(sh, param, val);
@ -112,7 +112,7 @@ SWITCH_DECLARE(void) switch_core_speech_text_param_tts(switch_speech_handle_t *s
SWITCH_DECLARE(void) switch_core_speech_numeric_param_tts(switch_speech_handle_t *sh, char *param, int val)
{
assert(sh != NULL);
switch_assert(sh != NULL);
if (sh->speech_interface->speech_numeric_param_tts) {
sh->speech_interface->speech_numeric_param_tts(sh, param, val);
@ -121,7 +121,7 @@ SWITCH_DECLARE(void) switch_core_speech_numeric_param_tts(switch_speech_handle_t
SWITCH_DECLARE(void) switch_core_speech_float_param_tts(switch_speech_handle_t *sh, char *param, double val)
{
assert(sh != NULL);
switch_assert(sh != NULL);
if (sh->speech_interface->speech_float_param_tts) {
sh->speech_interface->speech_float_param_tts(sh, param, val);
@ -131,7 +131,7 @@ SWITCH_DECLARE(void) switch_core_speech_float_param_tts(switch_speech_handle_t *
SWITCH_DECLARE(switch_status_t) switch_core_speech_read_tts(switch_speech_handle_t *sh,
void *data, switch_size_t *datalen, uint32_t * rate, switch_speech_flag_t *flags)
{
assert(sh != NULL);
switch_assert(sh != NULL);
return sh->speech_interface->speech_read_tts(sh, data, datalen, rate, flags);
}

View File

@ -201,19 +201,19 @@ static void switch_core_standard_on_loopback(switch_core_session_t *session)
static void switch_core_standard_on_transmit(switch_core_session_t *session)
{
assert(session != NULL);
switch_assert(session != NULL);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Standard TRANSMIT\n");
}
static void switch_core_standard_on_hold(switch_core_session_t *session)
{
assert(session != NULL);
switch_assert(session != NULL);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Standard HOLD\n");
}
static void switch_core_standard_on_hibernate(switch_core_session_t *session)
{
assert(session != NULL);
switch_assert(session != NULL);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Standard HIBERNATE\n");
}
@ -368,14 +368,14 @@ SWITCH_DECLARE(void) switch_core_session_run(switch_core_session_t *session)
*/
assert(session != NULL);
switch_assert(session != NULL);
session->thread_running = 1;
endpoint_interface = session->endpoint_interface;
assert(endpoint_interface != NULL);
switch_assert(endpoint_interface != NULL);
driver_state_handler = endpoint_interface->state_handler;
assert(driver_state_handler != NULL);
switch_assert(driver_state_handler != NULL);
switch_mutex_lock(session->mutex);

View File

@ -89,7 +89,7 @@ static char *my_dup (const char *s)
{
size_t len = strlen (s) + 1;
void *new = malloc (len);
assert(new);
switch_assert(new);
return (char *) memcpy (new, s, len);
}
@ -207,13 +207,13 @@ static void *SWITCH_THREAD_FUNC switch_event_thread(switch_thread_t * thread, vo
void *pop;
int i, len[3] = { 0, 0, 0 };
assert(thread != NULL);
assert(obj == NULL);
assert(POOL_LOCK != NULL);
assert(RUNTIME_POOL != NULL);
assert(EVENT_QUEUE_MUTEX != NULL);
assert(EVENT_QUEUE_HAVEMORE_MUTEX != NULL);
assert(EVENT_QUEUE_CONDITIONAL != NULL);
switch_assert(thread != NULL);
switch_assert(obj == NULL);
switch_assert(POOL_LOCK != NULL);
switch_assert(RUNTIME_POOL != NULL);
switch_assert(EVENT_QUEUE_MUTEX != NULL);
switch_assert(EVENT_QUEUE_HAVEMORE_MUTEX != NULL);
switch_assert(EVENT_QUEUE_CONDITIONAL != NULL);
THREAD_RUNNING = 1;
queues[0] = EVENT_QUEUE[SWITCH_PRIORITY_HIGH];
@ -319,8 +319,8 @@ SWITCH_DECLARE(switch_status_t) switch_event_running(void)
SWITCH_DECLARE(char *) switch_event_name(switch_event_types_t event)
{
assert(BLOCK != NULL);
assert(RUNTIME_POOL != NULL);
switch_assert(BLOCK != NULL);
switch_assert(RUNTIME_POOL != NULL);
return EVENT_NAMES[event];
}
@ -328,8 +328,8 @@ SWITCH_DECLARE(char *) switch_event_name(switch_event_types_t event)
SWITCH_DECLARE(switch_status_t) switch_name_event(char *name, switch_event_types_t *type)
{
switch_event_types_t x;
assert(BLOCK != NULL);
assert(RUNTIME_POOL != NULL);
switch_assert(BLOCK != NULL);
switch_assert(RUNTIME_POOL != NULL);
for (x = 0; x <= SWITCH_EVENT_ALL; x++) {
if ((strlen(name) > 13 && !strcasecmp(name + 13, EVENT_NAMES[x])) || !strcasecmp(name, EVENT_NAMES[x])) {
@ -347,8 +347,8 @@ SWITCH_DECLARE(switch_status_t) switch_event_reserve_subclass_detailed(char *own
switch_event_subclass_t *subclass;
assert(RUNTIME_POOL != NULL);
assert(CUSTOM_HASH != NULL);
switch_assert(RUNTIME_POOL != NULL);
switch_assert(CUSTOM_HASH != NULL);
if (switch_core_hash_find(CUSTOM_HASH, subclass_name)) {
return SWITCH_STATUS_INUSE;
@ -448,7 +448,7 @@ SWITCH_DECLARE(switch_status_t) switch_event_init(switch_memory_pool_t *pool)
switch_find_local_ip(guess_ip_v4, sizeof(guess_ip_v4), AF_INET);
switch_find_local_ip(guess_ip_v6, sizeof(guess_ip_v6), AF_INET6);
assert(pool != NULL);
switch_assert(pool != NULL);
THRUNTIME_POOL = RUNTIME_POOL = pool;
/*
@ -501,7 +501,7 @@ SWITCH_DECLARE(switch_status_t) switch_event_create_subclass(switch_event_t **ev
*event = (switch_event_t *) pop;
} else {
*event = ALLOC(sizeof(switch_event_t));
assert(*event);
switch_assert(*event);
}
memset(*event, 0, sizeof(switch_event_t));
@ -594,7 +594,7 @@ SWITCH_DECLARE(switch_status_t) switch_event_add_header(switch_event_t *event, s
header = (switch_event_header_t *) pop;
} else {
header = ALLOC(sizeof(*header));
assert(header);
switch_assert(header);
}
memset(header, 0, sizeof(*header));
@ -899,12 +899,12 @@ SWITCH_DECLARE(switch_status_t) switch_event_fire_detailed(char *file, char *fun
switch_size_t retsize;
switch_time_t ts = switch_timestamp_now();
assert(BLOCK != NULL);
assert(RUNTIME_POOL != NULL);
assert(EVENT_QUEUE_HAVEMORE_MUTEX != NULL);
assert(EVENT_QUEUE_MUTEX != NULL);
assert(EVENT_QUEUE_CONDITIONAL != NULL);
assert(RUNTIME_POOL != NULL);
switch_assert(BLOCK != NULL);
switch_assert(RUNTIME_POOL != NULL);
switch_assert(EVENT_QUEUE_HAVEMORE_MUTEX != NULL);
switch_assert(EVENT_QUEUE_MUTEX != NULL);
switch_assert(EVENT_QUEUE_CONDITIONAL != NULL);
switch_assert(RUNTIME_POOL != NULL);
if (THREAD_RUNNING <= 0) {
/* sorry we're closed */
@ -976,8 +976,8 @@ SWITCH_DECLARE(switch_status_t) switch_event_bind(const char *id, switch_event_t
switch_event_node_t *event_node;
switch_event_subclass_t *subclass = NULL;
assert(BLOCK != NULL);
assert(RUNTIME_POOL != NULL);
switch_assert(BLOCK != NULL);
switch_assert(RUNTIME_POOL != NULL);
if (subclass_name) {
if ((subclass = switch_core_hash_find(CUSTOM_HASH, subclass_name)) == 0) {

View File

@ -45,7 +45,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_sleep(switch_core_session_t *session,
int32_t left, elapsed;
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
switch_assert(channel != NULL);
start = switch_time_now();
@ -125,7 +125,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_deactivate_unicast(switch_core_sessio
int sanity = 0;
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
switch_assert(channel != NULL);
if (!switch_channel_test_flag(channel, CF_UNICAST)) {
return SWITCH_STATUS_FALSE;
@ -163,10 +163,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_activate_unicast(switch_core_session_
switch_codec_t *read_codec;
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
switch_assert(channel != NULL);
conninfo = switch_core_session_alloc(session, sizeof(*conninfo));
assert(conninfo != NULL);
switch_assert(conninfo != NULL);
conninfo->local_ip = switch_core_session_strdup(session, local_ip);
conninfo->local_port = local_port;
@ -269,8 +269,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_parse_event(switch_core_session_t *se
char *event_lock = switch_event_get_header(event, "event-lock");
switch_status_t status = SWITCH_STATUS_FALSE;
assert(channel != NULL);
assert(event != NULL);
switch_assert(channel != NULL);
switch_assert(event != NULL);
if (switch_strlen_zero(cmd)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Command!\n");
@ -382,7 +382,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_parse_all_events(switch_core_session_
switch_channel_t *channel;
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
switch_assert(channel != NULL);
while (switch_core_session_dequeue_private_event(session, &event) == SWITCH_STATUS_SUCCESS) {
switch_ivr_parse_event(session, event);
@ -404,7 +404,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_park(switch_core_session_t *session,
switch_codec_t *read_codec = switch_core_session_get_read_codec(session);
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
switch_assert(channel != NULL);
if (!switch_channel_test_flag(channel, CF_ANSWERED)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Careful, Channel is unaswered. Pre-answering...\n");
@ -539,7 +539,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_collect_digits_callback(switch_core_s
uint32_t elapsed;
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
switch_assert(channel != NULL);
if (!args->input_callback) {
return SWITCH_STATUS_GENERR;
@ -606,7 +606,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_collect_digits_count(switch_core_sess
uint32_t elapsed;
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
switch_assert(channel != NULL);
if (terminator != NULL)
*terminator = '\0';
@ -680,7 +680,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_hold(switch_core_session_t *session)
msg.from = __FILE__;
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
switch_assert(channel != NULL);
switch_channel_set_flag(channel, CF_HOLD);
switch_channel_set_flag(channel, CF_SUSPEND);
@ -711,7 +711,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_unhold(switch_core_session_t *session
msg.from = __FILE__;
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
switch_assert(channel != NULL);
switch_channel_clear_flag(channel, CF_HOLD);
switch_channel_clear_flag(channel, CF_SUSPEND);
@ -747,7 +747,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_media(const char *uuid, switch_media_
if ((session = switch_core_session_locate(uuid))) {
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
switch_assert(channel != NULL);
if ((flags & SMF_REBRIDGE) && !switch_channel_test_flag(channel, CF_ORIGINATOR)) {
swap = 1;
}
@ -760,7 +760,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_media(const char *uuid, switch_media_
&& (other_uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BRIDGE_VARIABLE))
&& (other_session = switch_core_session_locate(other_uuid))) {
other_channel = switch_core_session_get_channel(other_session);
assert(other_channel != NULL);
switch_assert(other_channel != NULL);
switch_core_session_receive_message(other_session, &msg);
switch_channel_clear_state_handler(other_channel, NULL);
switch_core_session_rwunlock(other_session);
@ -800,7 +800,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_nomedia(const char *uuid, switch_medi
if ((session = switch_core_session_locate(uuid))) {
status = SWITCH_STATUS_SUCCESS;
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
switch_assert(channel != NULL);
if ((flags & SMF_REBRIDGE) && !switch_channel_test_flag(channel, CF_ORIGINATOR)) {
swap = 1;
@ -812,7 +812,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_nomedia(const char *uuid, switch_medi
if ((flags & SMF_REBRIDGE) && (other_uuid = switch_channel_get_variable(channel, SWITCH_BRIDGE_VARIABLE)) &&
(other_session = switch_core_session_locate(other_uuid))) {
other_channel = switch_core_session_get_channel(other_session);
assert(other_channel != NULL);
switch_assert(other_channel != NULL);
switch_core_session_receive_message(other_session, &msg);
switch_channel_clear_state_handler(other_channel, NULL);
@ -843,11 +843,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_session_transfer(switch_core_session_
switch_channel_t *other_channel = NULL;
const char *uuid = NULL;
assert(session != NULL);
switch_assert(session != NULL);
switch_core_session_reset(session);
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
switch_assert(channel != NULL);
/* clear all state handlers */
switch_channel_clear_state_handler(channel, NULL);
@ -893,7 +893,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_session_transfer(switch_core_session_
if (uuid && (other_session = switch_core_session_locate(uuid))) {
other_channel = switch_core_session_get_channel(other_session);
assert(other_channel != NULL);
switch_assert(other_channel != NULL);
switch_channel_set_variable(other_channel, SWITCH_SIGNAL_BOND_VARIABLE, NULL);
switch_core_session_rwunlock(other_session);
}
@ -901,7 +901,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_session_transfer(switch_core_session_
if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BRIDGE_VARIABLE))
&& (other_session = switch_core_session_locate(uuid))) {
other_channel = switch_core_session_get_channel(other_session);
assert(other_channel != NULL);
switch_assert(other_channel != NULL);
switch_channel_set_variable(channel, SWITCH_SIGNAL_BRIDGE_VARIABLE, NULL);
switch_channel_set_variable(other_channel, SWITCH_SIGNAL_BRIDGE_VARIABLE, NULL);
@ -1309,7 +1309,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_generate_xml_cdr(switch_core_session_
int cdr_off = 0, v_off = 0;
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
switch_assert(channel != NULL);
if (!(cdr = switch_xml_new("cdr"))) {
return SWITCH_STATUS_SUCCESS;

View File

@ -174,7 +174,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_stop_displace_session(switch_core_ses
switch_media_bug_t *bug;
switch_channel_t *channel = switch_core_session_get_channel(session);
assert(channel != NULL);
switch_assert(channel != NULL);
if ((bug = switch_channel_get_private(channel, file))) {
switch_channel_set_private(channel, file, NULL);
switch_core_media_bug_remove(session, &bug);
@ -196,7 +196,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_displace_session(switch_core_session_
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
switch_assert(channel != NULL);
if ((bug = switch_channel_get_private(channel, file))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Only 1 of the same file per channel please!\n");
@ -210,7 +210,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_displace_session(switch_core_session_
read_codec = switch_core_session_get_read_codec(session);
assert(read_codec != NULL);
switch_assert(read_codec != NULL);
dh->fh.channels = read_codec->implementation->number_of_channels;
dh->fh.samplerate = read_codec->implementation->actual_samples_per_second;
@ -272,9 +272,9 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s
switch_channel_t *channel;
session = switch_core_media_bug_get_session(bug);
assert(session != NULL);
switch_assert(session != NULL);
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
switch_assert(channel != NULL);
if (switch_core_media_bug_read(bug, &frame) == SWITCH_STATUS_SUCCESS) {
int doit = 1;
@ -302,7 +302,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_stop_record_session(switch_core_sessi
switch_media_bug_t *bug;
switch_channel_t *channel = switch_core_session_get_channel(session);
assert(channel != NULL);
switch_assert(channel != NULL);
if ((bug = switch_channel_get_private(channel, file))) {
switch_channel_set_private(channel, file, NULL);
switch_core_media_bug_remove(session, &bug);
@ -595,7 +595,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_session(switch_core_session_t
switch_media_bug_flag_t flags = SMBF_READ_STREAM | SMBF_WRITE_STREAM;
uint8_t channels;
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
switch_assert(channel != NULL);
if ((bug = switch_channel_get_private(channel, file))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Only 1 of the same file per channel please!\n");
@ -609,7 +609,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_session(switch_core_session_t
}
read_codec = switch_core_session_get_read_codec(session);
assert(read_codec != NULL);
switch_assert(read_codec != NULL);
channels = read_codec->implementation->number_of_channels;
@ -703,7 +703,7 @@ static switch_bool_t inband_dtmf_callback(switch_media_bug_t *bug, void *user_da
char digit_str[80];
switch_channel_t *channel = switch_core_session_get_channel(pvt->session);
assert(channel != NULL);
switch_assert(channel != NULL);
frame.data = data;
frame.buflen = SWITCH_RECOMMENDED_BUFFER_SIZE;
@ -735,7 +735,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_stop_inband_dtmf_session(switch_core_
switch_media_bug_t *bug;
switch_channel_t *channel = switch_core_session_get_channel(session);
assert(channel != NULL);
switch_assert(channel != NULL);
if ((bug = switch_channel_get_private(channel, "dtmf"))) {
switch_channel_set_private(channel, "dtmf", NULL);
switch_core_media_bug_remove(session, &bug);
@ -755,10 +755,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_inband_dtmf_session(switch_core_sessi
switch_inband_dtmf_t *pvt;
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
switch_assert(channel != NULL);
read_codec = switch_core_session_get_read_codec(session);
assert(read_codec != NULL);
switch_assert(read_codec != NULL);
if (!(pvt = switch_core_session_alloc(session, sizeof(*pvt)))) {
return SWITCH_STATUS_MEMERR;
@ -885,7 +885,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_stop_inband_dtmf_generate_session(swi
switch_media_bug_t *bug;
switch_channel_t *channel = switch_core_session_get_channel(session);
assert(channel != NULL);
switch_assert(channel != NULL);
if ((bug = switch_channel_get_private(channel, "dtmf_generate"))) {
switch_channel_set_private(channel, "dtmf_generate", NULL);
switch_core_media_bug_remove(session, &bug);
@ -905,10 +905,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_inband_dtmf_generate_session(switch_c
switch_inband_dtmf_generate_t *pvt;
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
switch_assert(channel != NULL);
read_codec = switch_core_session_get_read_codec(session);
assert(read_codec != NULL);
switch_assert(read_codec != NULL);
if (!(pvt = switch_core_session_alloc(session, sizeof(*pvt)))) {
return SWITCH_STATUS_MEMERR;
@ -1014,7 +1014,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_stop_tone_detect_session(switch_core_
switch_channel_t *channel = switch_core_session_get_channel(session);
switch_tone_container_t *cont;
assert(channel != NULL);
switch_assert(channel != NULL);
if ((cont = switch_channel_get_private(channel, "_tone_detect_"))) {
switch_channel_set_private(channel, "_tone_detect_", NULL);
switch_core_media_bug_remove(session, &cont->bug);
@ -1040,10 +1040,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_tone_detect_session(switch_core_sessi
switch_media_bug_flag_t bflags = 0;
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
switch_assert(channel != NULL);
read_codec = switch_core_session_get_read_codec(session);
assert(read_codec != NULL);
switch_assert(read_codec != NULL);
if (switch_strlen_zero(key)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Key Specified!\n");
@ -1268,7 +1268,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_stop_detect_speech(switch_core_sessio
switch_channel_t *channel = switch_core_session_get_channel(session);
struct speech_thread_handle *sth;
assert(channel != NULL);
switch_assert(channel != NULL);
if ((sth = switch_channel_get_private(channel, SWITCH_SPEECH_KEY))) {
switch_channel_set_private(channel, SWITCH_SPEECH_KEY, NULL);
switch_core_media_bug_remove(session, &sth->bug);
@ -1286,7 +1286,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_pause_detect_speech(switch_core_sessi
switch_channel_t *channel = switch_core_session_get_channel(session);
struct speech_thread_handle *sth;
assert(channel != NULL);
switch_assert(channel != NULL);
if ((sth = switch_channel_get_private(channel, SWITCH_SPEECH_KEY))) {
switch_core_asr_pause(sth->ah);
return SWITCH_STATUS_SUCCESS;
@ -1301,7 +1301,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_resume_detect_speech(switch_core_sess
switch_channel_t *channel = switch_core_session_get_channel(session);
struct speech_thread_handle *sth;
assert(channel != NULL);
switch_assert(channel != NULL);
if ((sth = switch_channel_get_private(channel, SWITCH_SPEECH_KEY))) {
switch_core_asr_resume(sth->ah);
return SWITCH_STATUS_SUCCESS;
@ -1318,7 +1318,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech_load_grammar(switch_cor
switch_asr_flag_t flags = SWITCH_ASR_FLAG_NONE;
struct speech_thread_handle *sth;
assert(channel != NULL);
switch_assert(channel != NULL);
if ((sth = switch_channel_get_private(channel, SWITCH_SPEECH_KEY))) {
if (switch_core_asr_load_grammar(sth->ah, grammar, path) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Error loading Grammar\n");
@ -1340,7 +1340,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech_unload_grammar(switch_c
switch_asr_flag_t flags = SWITCH_ASR_FLAG_NONE;
struct speech_thread_handle *sth;
assert(channel != NULL);
switch_assert(channel != NULL);
if ((sth = switch_channel_get_private(channel, SWITCH_SPEECH_KEY))) {
if (switch_core_asr_unload_grammar(sth->ah, grammar) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Error unloading Grammar\n");
@ -1376,10 +1376,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech(switch_core_session_t *
}
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
switch_assert(channel != NULL);
read_codec = switch_core_session_get_read_codec(session);
assert(read_codec != NULL);
switch_assert(read_codec != NULL);
if ((val = switch_channel_get_variable(channel, "fire_asr_events"))) {
@ -1443,7 +1443,7 @@ SWITCH_STANDARD_SCHED_FUNC(sch_hangup_callback)
switch_core_session_t *session, *other_session;
const char *other_uuid;
assert(task);
switch_assert(task);
helper = (struct hangup_helper *) task->cmd_arg;
@ -1492,7 +1492,7 @@ SWITCH_STANDARD_SCHED_FUNC(sch_transfer_callback)
struct transfer_helper *helper;
switch_core_session_t *session;
assert(task);
switch_assert(task);
helper = (struct transfer_helper *) task->cmd_arg;
@ -1558,7 +1558,7 @@ struct broadcast_helper {
SWITCH_STANDARD_SCHED_FUNC(sch_broadcast_callback)
{
struct broadcast_helper *helper;
assert(task);
switch_assert(task);
helper = (struct broadcast_helper *) task->cmd_arg;
switch_ivr_broadcast(helper->uuid_str, helper->path, helper->flags);
@ -1593,7 +1593,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_broadcast(const char *uuid, const cha
const char *other_uuid = NULL;
char *app = "playback";
assert(path);
switch_assert(path);
if ((session = switch_core_session_locate(uuid))) {
char *cause = NULL;
@ -1603,7 +1603,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_broadcast(const char *uuid, const cha
master = session;
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
switch_assert(channel != NULL);
if ((switch_channel_test_flag(channel, CF_EVENT_PARSE))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Channel [%s] already broadcasting...broadcast aborted\n",

View File

@ -233,7 +233,7 @@ static switch_status_t audio_bridge_on_loopback(switch_core_session_t *session)
switch_ivr_bridge_data_t *bd;
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
switch_assert(channel != NULL);
if ((bd = (switch_ivr_bridge_data_t *) switch_channel_get_private(channel, "_bridge_"))) {
switch_channel_set_private(channel, "_bridge_", NULL);
@ -260,7 +260,7 @@ static switch_status_t audio_bridge_on_ring(switch_core_session_t *session)
switch_channel_t *channel = NULL;
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
switch_assert(channel != NULL);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CUSTOM RING\n", switch_channel_get_name(channel));
@ -274,7 +274,7 @@ static switch_status_t audio_bridge_on_hold(switch_core_session_t *session)
switch_channel_t *channel = NULL;
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
switch_assert(channel != NULL);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CUSTOM HOLD\n", switch_channel_get_name(channel));
@ -298,7 +298,7 @@ static switch_status_t uuid_bridge_on_reset(switch_core_session_t *session)
switch_channel_t *channel = NULL;
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
switch_assert(channel != NULL);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CUSTOM RESET\n", switch_channel_get_name(channel));
@ -318,7 +318,7 @@ static switch_status_t uuid_bridge_on_transmit(switch_core_session_t *session)
const char *other_uuid = NULL;
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
switch_assert(channel != NULL);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CUSTOM TRANSMIT\n", switch_channel_get_name(channel));
switch_channel_clear_state_handler(channel, NULL);
@ -407,7 +407,7 @@ static switch_status_t signal_bridge_on_hibernate(switch_core_session_t *session
switch_channel_t *channel = NULL;
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
switch_assert(channel != NULL);
switch_channel_clear_flag(channel, CF_TRANSFER);
switch_channel_set_variable(channel, SWITCH_BRIDGE_VARIABLE, switch_channel_get_variable(channel, SWITCH_SIGNAL_BRIDGE_VARIABLE));
@ -423,7 +423,7 @@ static switch_status_t signal_bridge_on_hangup(switch_core_session_t *session)
switch_event_t *event;
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
switch_assert(channel != NULL);
if (switch_channel_test_flag(channel, CF_ORIGINATOR)) {
switch_channel_clear_flag(channel, CF_ORIGINATOR);
@ -439,7 +439,7 @@ static switch_status_t signal_bridge_on_hangup(switch_core_session_t *session)
switch_channel_t *other_channel = NULL;
other_channel = switch_core_session_get_channel(other_session);
assert(other_channel != NULL);
switch_assert(other_channel != NULL);
switch_channel_set_variable(channel, SWITCH_SIGNAL_BRIDGE_VARIABLE, NULL);
switch_channel_set_variable(other_channel, SWITCH_SIGNAL_BRIDGE_VARIABLE, NULL);
@ -480,10 +480,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_signal_bridge(switch_core_session_t *
switch_event_t *event;
caller_channel = switch_core_session_get_channel(session);
assert(caller_channel != NULL);
switch_assert(caller_channel != NULL);
peer_channel = switch_core_session_get_channel(peer_session);
assert(peer_channel != NULL);
switch_assert(peer_channel != NULL);
if (!switch_channel_ready(peer_channel)) {
switch_channel_hangup(caller_channel, switch_channel_get_cause(peer_channel));
@ -547,21 +547,21 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_multi_threaded_bridge(switch_core_ses
int stream_id = 0;
switch_status_t status = SWITCH_STATUS_SUCCESS;
assert(session != NULL);
assert(peer_session != NULL);
switch_assert(session != NULL);
switch_assert(peer_session != NULL);
caller_channel = switch_core_session_get_channel(session);
assert(caller_channel != NULL);
switch_assert(caller_channel != NULL);
switch_channel_set_flag(caller_channel, CF_ORIGINATOR);
peer_channel = switch_core_session_get_channel(peer_session);
assert(peer_channel != NULL);
switch_assert(peer_channel != NULL);
a_leg = switch_core_session_alloc(session, sizeof(*a_leg));
b_leg = switch_core_session_alloc(peer_session, sizeof(*b_leg));
assert(a_leg && b_leg);
switch_assert(a_leg && b_leg);
b_leg->session = peer_session;
switch_copy_string(b_leg->b_uuid, switch_core_session_get_uuid(session), sizeof(b_leg->b_uuid));

View File

@ -38,7 +38,7 @@ static switch_status_t originate_on_ring(switch_core_session_t *session)
switch_channel_t *channel = NULL;
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
switch_assert(channel != NULL);
/* put the channel in a passive state so we can loop audio to it */
@ -323,7 +323,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
switch_event_header_t *hi;
caller_channel = switch_core_session_get_channel(session);
assert(caller_channel != NULL);
switch_assert(caller_channel != NULL);
/* Copy all the applicable channel variables into the event */
if ((hi = switch_channel_variable_first(caller_channel))) {
@ -444,7 +444,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
for (try = 0; try < retries; try++) {
switch_safe_free(loop_data);
loop_data = strdup(data);
assert(loop_data);
switch_assert(loop_data);
or_argc = switch_separate_string(loop_data, '|', pipe_names, (sizeof(pipe_names) / sizeof(pipe_names[0])));
if (caller_channel && or_argc > 1 && !ringback_data) {
@ -574,7 +574,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
caller_profiles[i] = new_profile;
peer_sessions[i] = new_session;
peer_channels[i] = switch_core_session_get_channel(new_session);
assert(peer_channels[i] != NULL);
switch_assert(peer_channels[i] != NULL);
if (var_event) {
@ -585,7 +585,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
switch_channel_set_variable(peer_channels[i], header->name, header->value);
}
switch_event_create(&event, SWITCH_EVENT_CHANNEL_ORIGINATE);
assert(event);
switch_assert(event);
switch_channel_event_set_data(peer_channels[i], event);
switch_event_fire(&event);
}

View File

@ -103,7 +103,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_phrase_macro(switch_core_session_t *s
int matches = 0;
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
switch_assert(channel != NULL);
if (!macro_name) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No phrase macro specified.\n");
@ -356,10 +356,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se
}
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
switch_assert(channel != NULL);
read_codec = switch_core_session_get_read_codec(session);
assert(read_codec != NULL);
switch_assert(read_codec != NULL);
fh->channels = read_codec->implementation->number_of_channels;
@ -602,10 +602,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_gentones(switch_core_session_t *sessi
switch_byte_t data[1024];
switch_channel_t *channel;
assert(session != NULL);
switch_assert(session != NULL);
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
switch_assert(channel != NULL);
switch_channel_pre_answer(channel);
read_codec = switch_core_session_get_read_codec(session);
@ -711,7 +711,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
const char *prebuf;
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
switch_assert(channel != NULL);
prefix = switch_channel_get_variable(channel, "sound_prefix");
timer_name = switch_channel_get_variable(channel, "timer_name");
@ -819,7 +819,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
"ARTIST=%s\n" "COMMENT=%s\n" "DATE=%s\n", file, fh->samplerate, fh->channels, title, copyright, software, artist, comment, date);
#endif
assert(read_codec != NULL);
switch_assert(read_codec != NULL);
interval = read_codec->implementation->microseconds_per_frame / 1000;
if (!fh->audio_buffer) {
@ -1137,7 +1137,7 @@ SWITCH_DECLARE(switch_status_t) switch_play_and_get_digits(switch_core_session_t
channel = switch_core_session_get_channel(session);
//Make sure somebody is home
assert(channel != NULL);
switch_assert(channel != NULL);
//Answer the channel if it hasn't already been answered
switch_channel_answer(channel);
@ -1254,7 +1254,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text_handle(switch_core_session
switch_size_t starlen, poundlen;
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
switch_assert(channel != NULL);
if (!sh) {
return SWITCH_STATUS_FALSE;
@ -1320,7 +1320,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text_handle(switch_core_session
write_frame.samples = len / 2;
write_frame.codec = codec;
assert(codec->implementation != NULL);
switch_assert(codec->implementation != NULL);
for (x = 0; !done && x < lead_in_out; x++) {
switch_yield(codec->implementation->microseconds_per_frame);
@ -1502,7 +1502,7 @@ SWITCH_DECLARE(void) switch_ivr_clear_speech_cache(switch_core_session_t *sessio
switch_channel_t *channel;
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
switch_assert(channel != NULL);
if ((cache_obj = switch_channel_get_private(channel, SWITCH_CACHE_SPEECH_HANDLES_OBJ_NAME))) {
switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_NONE;
@ -1539,7 +1539,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text(switch_core_session_t *ses
int need_create = 1, need_alloc = 1;
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
switch_assert(channel != NULL);
sh = &lsh;
codec = &lcodec;

View File

@ -83,8 +83,8 @@ static void *switch_loadable_module_exec(switch_thread_t * thread, void *obj)
switch_loadable_module_t *module = ts->objs[0];
int restarts;
assert(thread != NULL);
assert(module != NULL);
switch_assert(thread != NULL);
switch_assert(module != NULL);
for (restarts = 0; status != SWITCH_STATUS_TERM; restarts++) {
status = module->switch_module_runtime();
@ -653,7 +653,7 @@ static switch_status_t switch_loadable_module_load_file(char *path, char *filena
char derr[512] = "";
switch_memory_pool_t *pool;
assert(path != NULL);
switch_assert(path != NULL);
switch_core_new_memory_pool(&pool);
*new_module = NULL;
@ -1060,7 +1060,7 @@ SWITCH_DECLARE(switch_status_t) switch_loadable_module_init()
static void do_shutdown(switch_loadable_module_t *module)
{
assert(module != NULL);
switch_assert(module != NULL);
switch_loadable_module_unprocess(module);
if (module->switch_module_shutdown) {
@ -1328,9 +1328,9 @@ SWITCH_DECLARE(switch_status_t) switch_api_execute(const char *cmd, const char *
switch_api_interface_t *api;
switch_status_t status;
assert(stream != NULL);
assert(stream->data != NULL);
assert(stream->write_function != NULL);
switch_assert(stream != NULL);
switch_assert(stream->data != NULL);
switch_assert(stream->write_function != NULL);
if (!stream->event) {
switch_event_create(&stream->event, SWITCH_EVENT_API);
@ -1366,7 +1366,7 @@ SWITCH_DECLARE(switch_loadable_module_interface_t *) switch_loadable_module_crea
switch_loadable_module_interface_t *mod;
mod = switch_core_alloc(pool, sizeof(switch_loadable_module_interface_t));
assert(mod != NULL);
switch_assert(mod != NULL);
mod->pool = pool;
@ -1378,7 +1378,7 @@ SWITCH_DECLARE(switch_loadable_module_interface_t *) switch_loadable_module_crea
#define ALLOC_INTERFACE(_TYPE_) { \
switch_##_TYPE_##_interface_t *i, *ptr; \
i = switch_core_alloc(mod->pool, sizeof(switch_##_TYPE_##_interface_t)); \
assert(i != NULL); \
switch_assert(i != NULL); \
for (ptr = mod->_TYPE_##_interface; ptr && ptr->next; ptr = ptr->next); \
if (ptr) { \
ptr->next = i; \

View File

@ -77,7 +77,7 @@ SWITCH_DECLARE(uint32_t) switch_log_str2mask(const char *str)
char *p = strdup(str);
switch_log_level_t level;
assert(p);
switch_assert(p);
if ((argc = switch_separate_string(p, ',', argv, (sizeof(argv) / sizeof(argv[0]))))) {
for (x = 0; x < argc; x++) {
@ -121,7 +121,7 @@ SWITCH_DECLARE(switch_log_level_t) switch_log_str2level(const char *str)
SWITCH_DECLARE(switch_status_t) switch_log_bind_logger(switch_log_function_t function, switch_log_level_t level)
{
switch_log_binding_t *binding = NULL, *ptr = NULL;
assert(function != NULL);
switch_assert(function != NULL);
if (!(binding = switch_core_alloc(LOG_POOL, sizeof(*binding)))) {
return SWITCH_STATUS_MEMERR;
@ -263,7 +263,7 @@ SWITCH_DECLARE(void) switch_log_printf(switch_text_channel_t channel, const char
node = (switch_log_node_t *) pop;
} else {
node = malloc(sizeof(*node));
assert(node);
switch_assert(node);
}
node->data = data;
@ -292,7 +292,7 @@ SWITCH_DECLARE(switch_status_t) switch_log_init(switch_memory_pool_t *pool)
switch_thread_t *thread;
switch_threadattr_t *thd_attr;;
assert(pool != NULL);
switch_assert(pool != NULL);
LOG_POOL = pool;

View File

@ -320,7 +320,7 @@ SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_callback_exec(switch_odb
SQLLEN m = 0, t = 0;
int result;
assert(callback != NULL);
switch_assert(callback != NULL);
if (!db_is_up(handle)) {
goto error;
@ -358,7 +358,7 @@ SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_callback_exec(switch_odb
names = calloc(c, sizeof(*names));
vals = calloc(c, sizeof(*vals));
assert(names && vals);
switch_assert(names && vals);
for (x = 1; x <= c; x++) {
SQLSMALLINT NameLength, DataType, DecimalDigits, Nullable;

View File

@ -183,8 +183,8 @@ static switch_status_t ice_out(switch_rtp_t *rtp_session)
unsigned int elapsed;
switch_size_t bytes;
assert(rtp_session != NULL);
assert(rtp_session->ice_user != NULL);
switch_assert(rtp_session != NULL);
switch_assert(rtp_session->ice_user != NULL);
if (rtp_session->stuncount != 0) {
rtp_session->stuncount--;
@ -668,10 +668,10 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_activate_ice(switch_rtp_t *rtp_sessio
SWITCH_DECLARE(void) switch_rtp_kill_socket(switch_rtp_t *rtp_session)
{
assert(rtp_session != NULL);
switch_assert(rtp_session != NULL);
switch_mutex_lock(rtp_session->flag_mutex);
if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_IO)) {
assert(rtp_session->sock != NULL);
switch_assert(rtp_session->sock != NULL);
switch_socket_shutdown(rtp_session->sock, SWITCH_SHUTDOWN_READWRITE);
switch_clear_flag(rtp_session, SWITCH_RTP_FLAG_IO);
}
@ -1592,7 +1592,7 @@ SWITCH_DECLARE(int) switch_rtp_write_frame(switch_rtp_t *rtp_session, switch_fra
return -1;
}
assert(frame != NULL);
switch_assert(frame != NULL);
if (switch_test_flag(frame, SFF_CNG)) {
payload = rtp_session->cng_pt;

View File

@ -158,7 +158,7 @@ SWITCH_DECLARE(uint32_t) switch_scheduler_add_task(time_t task_runtime,
switch_mutex_lock(globals.task_mutex);
switch_zmalloc(container, sizeof(*container));
assert(func);
switch_assert(func);
container->func = func;
container->task.created = time(NULL);
container->task.runtime = task_runtime;

View File

@ -86,7 +86,7 @@ SWITCH_DECLARE(char *) switch_amp_encode(char *s, char *buf, switch_size_t len)
{
char *p, *q;
switch_size_t x = 0;
assert(s);
switch_assert(s);
q = buf;
@ -408,7 +408,7 @@ SWITCH_DECLARE(char *) switch_replace_char(char *str, char from, char to, switch
if (dup) {
p = strdup(str);
assert(p);
switch_assert(p);
} else {
p = str;
}
@ -926,7 +926,7 @@ switch_inet_ntop6(unsigned char const *src, char *dst, size_t size)
SWITCH_DECLARE(char *) get_addr(char *buf, switch_size_t len, struct in_addr *in)
{
assert(buf);
switch_assert(buf);
*buf = '\0';
if (in) {
switch_inet_ntop(AF_INET, in, buf, len);