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

FreeSWITCH SVN anthm at freeswitch.org
Fri Apr 10 14:37:17 PDT 2009


Author: anthm
Date: Fri Apr 10 16:37:17 2009
New Revision: 12989

Log:
refactor

Modified:
   freeswitch/trunk/src/switch_core_memory.c
   freeswitch/trunk/src/switch_core_session.c

Modified: freeswitch/trunk/src/switch_core_memory.c
==============================================================================
--- freeswitch/trunk/src/switch_core_memory.c	(original)
+++ freeswitch/trunk/src/switch_core_memory.c	Fri Apr 10 16:37:17 2009
@@ -135,8 +135,13 @@
 	switch_size_t len;
 	switch_assert(memory_manager.memory_pool != NULL);
 
-	if (!todup)
+	if (!todup) {
 		return NULL;
+	}
+
+	if (switch_strlen_zero(todup)) {
+		return SWITCH_BLANK_STRING;
+	}
 
 #ifdef LOCK_MORE
 #ifdef USE_MEM_LOCK
@@ -229,6 +234,11 @@
 	if (!todup) {
 		return NULL;
 	}
+
+	if (switch_strlen_zero(todup)) {
+		return SWITCH_BLANK_STRING;
+	}
+
 #ifdef LOCK_MORE
 #ifdef USE_MEM_LOCK
 	switch_mutex_lock(memory_manager.mem_lock);
@@ -264,6 +274,11 @@
 	if (!todup) {
 		return NULL;
 	}
+
+	if (switch_strlen_zero(todup)) {
+		return SWITCH_BLANK_STRING;
+	}
+
 #ifdef LOCK_MORE
 #ifdef USE_MEM_LOCK
 	switch_mutex_lock(memory_manager.mem_lock);

Modified: freeswitch/trunk/src/switch_core_session.c
==============================================================================
--- freeswitch/trunk/src/switch_core_session.c	(original)
+++ freeswitch/trunk/src/switch_core_session.c	Fri Apr 10 16:37:17 2009
@@ -1447,19 +1447,17 @@
 	session->stack_count++;
 
 	new_profile = switch_caller_profile_clone(session, profile);
-	new_profile->destination_number = switch_core_session_strdup(session, exten);
+	new_profile->destination_number = switch_core_strdup(new_profile->pool, exten);
 
 	if (!switch_strlen_zero(dialplan)) {
-		new_profile->dialplan = switch_core_session_strdup(session, dialplan);
+		new_profile->dialplan = switch_core_strdup(new_profile->pool, dialplan);
 	}
 
 	if (!switch_strlen_zero(context)) {
-		new_profile->context = switch_core_session_strdup(session, context);
+		new_profile->context = switch_core_strdup(new_profile->pool, context);
 	}
 
-	if (!(dpstr = switch_core_session_strdup(session, new_profile->dialplan))) {
-		abort();
-	}
+	dpstr = switch_core_session_strdup(session, new_profile->dialplan);
 
 	argc = switch_separate_string(dpstr, ',', dp, (sizeof(dp) / sizeof(dp[0])));
 	for (x = 0; x < argc; x++) {



More information about the Freeswitch-svn mailing list