[Freeswitch-svn] [commit] r6661 - freeswitch/trunk/src

Freeswitch SVN mikej at freeswitch.org
Tue Dec 11 14:23:58 EST 2007


Author: mikej
Date: Tue Dec 11 14:23:57 2007
New Revision: 6661

Modified:
   freeswitch/trunk/src/switch_buffer.c
   freeswitch/trunk/src/switch_caller.c
   freeswitch/trunk/src/switch_channel.c
   freeswitch/trunk/src/switch_core.c
   freeswitch/trunk/src/switch_core_asr.c
   freeswitch/trunk/src/switch_core_codec.c
   freeswitch/trunk/src/switch_core_file.c
   freeswitch/trunk/src/switch_core_hash.c
   freeswitch/trunk/src/switch_core_io.c
   freeswitch/trunk/src/switch_core_memory.c
   freeswitch/trunk/src/switch_core_session.c
   freeswitch/trunk/src/switch_core_speech.c
   freeswitch/trunk/src/switch_core_state_machine.c
   freeswitch/trunk/src/switch_event.c
   freeswitch/trunk/src/switch_ivr.c
   freeswitch/trunk/src/switch_ivr_async.c
   freeswitch/trunk/src/switch_ivr_bridge.c
   freeswitch/trunk/src/switch_ivr_originate.c
   freeswitch/trunk/src/switch_ivr_play_say.c
   freeswitch/trunk/src/switch_loadable_module.c
   freeswitch/trunk/src/switch_log.c
   freeswitch/trunk/src/switch_odbc.c
   freeswitch/trunk/src/switch_rtp.c
   freeswitch/trunk/src/switch_scheduler.c
   freeswitch/trunk/src/switch_utils.c

Log:
use switch_assert macro

Modified: freeswitch/trunk/src/switch_buffer.c
==============================================================================
--- freeswitch/trunk/src/switch_buffer.c	(original)
+++ freeswitch/trunk/src/switch_buffer.c	Tue Dec 11 14:23:57 2007
@@ -126,7 +126,7 @@
 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_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_inuse(switch_buffer_t *buffer)
 {
-	assert(buffer != NULL);
+	switch_assert(buffer != NULL);
 
 	return buffer->used;
 }
@@ -159,7 +159,7 @@
 {
 	switch_size_t reading = 0;
 
-	assert(buffer != NULL);
+	switch_assert(buffer != NULL);
 
 	if (buffer->used < 1) {
 		buffer->used = 0;
@@ -202,8 +202,8 @@
 {
 	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_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(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;

Modified: freeswitch/trunk/src/switch_caller.c
==============================================================================
--- freeswitch/trunk/src/switch_caller.c	(original)
+++ freeswitch/trunk/src/switch_caller.c	Tue Dec 11 14:23:57 2007
@@ -54,7 +54,7 @@
 	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_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_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);

Modified: freeswitch/trunk/src/switch_channel.c
==============================================================================
--- freeswitch/trunk/src/switch_channel.c	(original)
+++ freeswitch/trunk/src/switch_channel.c	Tue Dec 11 14:23:57 2007
@@ -156,7 +156,7 @@
 
 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_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_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_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_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_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(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(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(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_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_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(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(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(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 @@
 {
 	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 @@
 {
 	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_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_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_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 @@
 {
 	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 @@
 	int ok = 0;
 
 
-	assert(channel != NULL);
+	switch_assert(channel != NULL);
 	switch_mutex_lock(channel->flag_mutex);
 
 	last_state = channel->state;
@@ -800,7 +800,7 @@
 		/* 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 @@
 		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_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(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(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(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_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(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 @@
 {
 	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 @@
 {
 	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_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_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_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_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_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_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 @@
 	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_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 @@
 					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 @@
 	}
 
 	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 @@
 				encode_len = new_len;
 			
 				tmp = realloc(encode_buf, encode_len);
-				assert(tmp);
+				switch_assert(tmp);
 				encode_buf = tmp;
 			}
 

Modified: freeswitch/trunk/src/switch_core.c
==============================================================================
--- freeswitch/trunk/src/switch_core.c	(original)
+++ freeswitch/trunk/src/switch_core.c	Tue Dec 11 14:23:57 2007
@@ -182,10 +182,10 @@
 	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 @@
 	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 @@
 		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 @@
 	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 @@
 		*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 @@
 		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);
 

Modified: freeswitch/trunk/src/switch_core_asr.c
==============================================================================
--- freeswitch/trunk/src/switch_core_asr.c	(original)
+++ freeswitch/trunk/src/switch_core_asr.c	Tue Dec 11 14:23:57 2007
@@ -54,7 +54,7 @@
 		}
 	}
 
-	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 @@
 	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_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_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);
 }

Modified: freeswitch/trunk/src/switch_core_codec.c
==============================================================================
--- freeswitch/trunk/src/switch_core_codec.c	(original)
+++ freeswitch/trunk/src/switch_core_codec.c	Tue Dec 11 14:23:57 2007
@@ -40,7 +40,7 @@
 	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_channel_t *channel;
 	char tmp[30];
 
-	assert(session != NULL);
+	switch_assert(session != NULL);
 	channel = switch_core_session_get_channel(session);
 
 
@@ -112,8 +112,8 @@
 	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 @@
 														 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 @@
 														 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_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");

Modified: freeswitch/trunk/src/switch_core_file.c
==============================================================================
--- freeswitch/trunk/src/switch_core_file.c	(original)
+++ freeswitch/trunk/src/switch_core_file.c	Tue Dec 11 14:23:57 2007
@@ -94,16 +94,16 @@
 
 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_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_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_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);

Modified: freeswitch/trunk/src/switch_core_hash.c
==============================================================================
--- freeswitch/trunk/src/switch_core_hash.c	(original)
+++ freeswitch/trunk/src/switch_core_hash.c	Tue Dec 11 14:23:57 2007
@@ -47,7 +47,7 @@
 	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_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;

Modified: freeswitch/trunk/src/switch_core_io.c
==============================================================================
--- freeswitch/trunk/src/switch_core_io.c	(original)
+++ freeswitch/trunk/src/switch_core_io.c	Tue Dec 11 14:23:57 2007
@@ -76,8 +76,8 @@
 		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 @@
 	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 @@
 		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 @@
 		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 @@
 				}
 				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 @@
 	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 @@
 		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;

Modified: freeswitch/trunk/src/switch_core_memory.c
==============================================================================
--- freeswitch/trunk/src/switch_core_memory.c	(original)
+++ freeswitch/trunk/src/switch_core_memory.c	Tue Dec 11 14:23:57 2007
@@ -45,8 +45,8 @@
 
 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(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 @@
 #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_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 @@
 
 	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 @@
 {
 	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 @@
 
 	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_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 @@
 	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 @@
 	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 @@
 {
 	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 @@
 #endif
 
 	duped = apr_pstrmemdup(session->pool, todup, len);
-	assert(duped != NULL);
+	switch_assert(duped != NULL);
 
 
 #ifdef LOCK_MORE
@@ -221,7 +221,7 @@
 {
 	char *duped = NULL;
 	switch_size_t len;
-	assert(pool != NULL);
+	switch_assert(pool != NULL);
 
 	if (!todup) {
 		return NULL;
@@ -238,7 +238,7 @@
 #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 @@
 	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 @@
 	//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 @@
 {
 	void *ptr = NULL;
 
-	assert(pool != NULL);
+	switch_assert(pool != NULL);
 
 #ifdef LOCK_MORE
 	switch_mutex_lock(memory_manager.mem_lock);
@@ -304,11 +304,11 @@
 
 #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 @@
 	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);

Modified: freeswitch/trunk/src/switch_core_session.c
==============================================================================
--- freeswitch/trunk/src/switch_core_session.c	(original)
+++ freeswitch/trunk/src/switch_core_session.c	Tue Dec 11 14:23:57 2007
@@ -144,14 +144,14 @@
 
 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 @@
 		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_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_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_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_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_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_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_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_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 @@
 	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(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 @@
 
 	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);

Modified: freeswitch/trunk/src/switch_core_speech.c
==============================================================================
--- freeswitch/trunk/src/switch_core_speech.c	(original)
+++ freeswitch/trunk/src/switch_core_speech.c	Tue Dec 11 14:23:57 2007
@@ -87,14 +87,14 @@
 
 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_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_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_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(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);
 }

Modified: freeswitch/trunk/src/switch_core_state_machine.c
==============================================================================
--- freeswitch/trunk/src/switch_core_state_machine.c	(original)
+++ freeswitch/trunk/src/switch_core_state_machine.c	Tue Dec 11 14:23:57 2007
@@ -201,19 +201,19 @@
 
 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 @@
 
 
 	 */
-	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);
 

Modified: freeswitch/trunk/src/switch_event.c
==============================================================================
--- freeswitch/trunk/src/switch_event.c	(original)
+++ freeswitch/trunk/src/switch_event.c	Tue Dec 11 14:23:57 2007
@@ -89,7 +89,7 @@
 {
     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 @@
 	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(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(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_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_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 @@
 		*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 @@
 			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_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_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) {

Modified: freeswitch/trunk/src/switch_ivr.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr.c	(original)
+++ freeswitch/trunk/src/switch_ivr.c	Tue Dec 11 14:23:57 2007
@@ -45,7 +45,7 @@
 	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 @@
 	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_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 @@
 	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_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_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 @@
 	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 @@
 	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 @@
 	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 @@
 	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 @@
 
 	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 @@
 				&& (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 @@
 	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 @@
 			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_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 @@
 		
 		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 @@
 		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 @@
 	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;

Modified: freeswitch/trunk/src/switch_ivr_async.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr_async.c	(original)
+++ freeswitch/trunk/src/switch_ivr_async.c	Tue Dec 11 14:23:57 2007
@@ -174,7 +174,7 @@
 	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 @@
 
 
 	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 @@
 
 
 	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 @@
 			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_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_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 @@
 	}
 
 	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 @@
 	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_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_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_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_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_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_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_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_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_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_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_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 @@
 	}
 
 	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_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 @@
 	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 @@
 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 @@
 	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 @@
 		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", 

Modified: freeswitch/trunk/src/switch_ivr_bridge.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr_bridge.c	(original)
+++ freeswitch/trunk/src/switch_ivr_bridge.c	Tue Dec 11 14:23:57 2007
@@ -233,7 +233,7 @@
 	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 @@
 	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 @@
 	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 @@
 	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 @@
 	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 @@
 	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 @@
 	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 @@
 		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_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 @@
 	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));

Modified: freeswitch/trunk/src/switch_ivr_originate.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr_originate.c	(original)
+++ freeswitch/trunk/src/switch_ivr_originate.c	Tue Dec 11 14:23:57 2007
@@ -38,7 +38,7 @@
 	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_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 @@
 	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 @@
 				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_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);
 				}

Modified: freeswitch/trunk/src/switch_ivr_play_say.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr_play_say.c	(original)
+++ freeswitch/trunk/src/switch_ivr_play_say.c	Tue Dec 11 14:23:57 2007
@@ -103,7 +103,7 @@
 	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 @@
 	}
 
 	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_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 @@
 	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 @@
 					  "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 @@
 	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_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 @@
 	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_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 @@
 	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;

Modified: freeswitch/trunk/src/switch_loadable_module.c
==============================================================================
--- freeswitch/trunk/src/switch_loadable_module.c	(original)
+++ freeswitch/trunk/src/switch_loadable_module.c	Tue Dec 11 14:23:57 2007
@@ -83,8 +83,8 @@
 	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 @@
 	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 @@
 
 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_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_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 @@
 #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;												\

Modified: freeswitch/trunk/src/switch_log.c
==============================================================================
--- freeswitch/trunk/src/switch_log.c	(original)
+++ freeswitch/trunk/src/switch_log.c	Tue Dec 11 14:23:57 2007
@@ -77,7 +77,7 @@
 	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_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 @@
 					node = (switch_log_node_t *) pop;
 				} else {
 					node = malloc(sizeof(*node));
-					assert(node);			
+					switch_assert(node);			
 				}
 
 				node->data = data;
@@ -292,7 +292,7 @@
 	switch_thread_t *thread;
 	switch_threadattr_t *thd_attr;;
 
-	assert(pool != NULL);
+	switch_assert(pool != NULL);
 
 	LOG_POOL = pool;
 

Modified: freeswitch/trunk/src/switch_odbc.c
==============================================================================
--- freeswitch/trunk/src/switch_odbc.c	(original)
+++ freeswitch/trunk/src/switch_odbc.c	Tue Dec 11 14:23:57 2007
@@ -320,7 +320,7 @@
 	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 @@
 			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;

Modified: freeswitch/trunk/src/switch_rtp.c
==============================================================================
--- freeswitch/trunk/src/switch_rtp.c	(original)
+++ freeswitch/trunk/src/switch_rtp.c	Tue Dec 11 14:23:57 2007
@@ -183,8 +183,8 @@
 	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(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 @@
 		return -1;
 	}
 
-	assert(frame != NULL);
+	switch_assert(frame != NULL);
 
 	if (switch_test_flag(frame, SFF_CNG)) {
 		payload = rtp_session->cng_pt;

Modified: freeswitch/trunk/src/switch_scheduler.c
==============================================================================
--- freeswitch/trunk/src/switch_scheduler.c	(original)
+++ freeswitch/trunk/src/switch_scheduler.c	Tue Dec 11 14:23:57 2007
@@ -158,7 +158,7 @@
 
 	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;

Modified: freeswitch/trunk/src/switch_utils.c
==============================================================================
--- freeswitch/trunk/src/switch_utils.c	(original)
+++ freeswitch/trunk/src/switch_utils.c	Tue Dec 11 14:23:57 2007
@@ -86,7 +86,7 @@
 {
 	char *p, *q;
 	switch_size_t x = 0;
-	assert(s);
+	switch_assert(s);
 
 	q = buf;
 
@@ -408,7 +408,7 @@
 
 	if (dup) {
 		p = strdup(str);
-		assert(p);
+		switch_assert(p);
 	} else {
 		p = str;
 	}
@@ -926,7 +926,7 @@
 
 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);



More information about the Freeswitch-svn mailing list