[asterisk-commits] mmichelson: branch mmichelson/forward-loop r87054 - in /team/mmichelson/forwa...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Oct 25 14:44:11 CDT 2007


Author: mmichelson
Date: Thu Oct 25 14:44:10 2007
New Revision: 87054

URL: http://svn.digium.com/view/asterisk?view=rev&rev=87054
Log:
Removed a bunch of redundant code from app_dial. Converted free() to ast_free()


Modified:
    team/mmichelson/forward-loop/apps/app_dial.c
    team/mmichelson/forward-loop/main/global_datastores.c

Modified: team/mmichelson/forward-loop/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/mmichelson/forward-loop/apps/app_dial.c?view=diff&rev=87054&r1=87053&r2=87054
==============================================================================
--- team/mmichelson/forward-loop/apps/app_dial.c (original)
+++ team/mmichelson/forward-loop/apps/app_dial.c Thu Oct 25 14:44:10 2007
@@ -1091,6 +1091,7 @@
 		struct dial_localuser *tmp;
 		/* Get a technology/[device:]number pair */
 		char *number = cur;
+		char *interface = ast_strdupa(number);
 		char *tech = strsep(&number, "/");
 		/* find if we already dialed this interface */
 		int dialed = 0;
@@ -1138,33 +1139,19 @@
 			dialed_interfaces = datastore->data;
 		AST_LIST_LOCK(dialed_interfaces);
 		AST_LIST_TRAVERSE(dialed_interfaces, di, list) {
-			char *dash;
-			char *name = ast_strdupa(tmp->chan->name);
-			if ((dash = strchr(name, '-')))
-				*dash = '\0';
 			/* XXX case sensitive??? */
-			ast_log(LOG_DEBUG, "Checking interface '%s' against '%s'\n", di->interface, name);
-			if(!strcasecmp(di->interface, name)) {
+			ast_log(LOG_DEBUG, "Checking interface '%s' against '%s'\n", di->interface, interface);
+			if(!strcasecmp(di->interface, interface)) {
 				dialed = 1;
 				break;
 			}
 		}
-		if(!dialed) {
-			char *blah;
-			char *tech;
-			char *interface = ast_strdupa(tmp->chan->name);
-			if ((blah = strchr(interface, '-')))
-				*blah = '\0';
-			tech = ast_strdupa(interface);
-			if ((blah = strchr(tech, '/')))
-				*blah = '\0';
-			if (strcasecmp(tech, "Local")) {
-				if(!(di = ast_calloc(1, sizeof(*di) + strlen(interface))))
-					goto out;
-				strcpy(di->interface, interface);
-				ast_log(LOG_DEBUG, "Adding interface '%s' to the list of dialed interfaces\n", di->interface);
-				AST_LIST_INSERT_TAIL(dialed_interfaces, di, list);
-			}
+		if(!dialed && strcasecmp(tech, "Local")) {
+			if(!(di = ast_calloc(1, sizeof(*di) + strlen(interface))))
+				goto out;
+			strcpy(di->interface, interface);
+			ast_log(LOG_DEBUG, "Adding interface '%s' to the list of dialed interfaces\n", di->interface);
+			AST_LIST_INSERT_TAIL(dialed_interfaces, di, list);
 		} else {
 			AST_LIST_UNLOCK(dialed_interfaces);
 			ast_log(LOG_DEBUG, "Skipping dialing interface '%s' since it has already been dialed\n", di->interface);

Modified: team/mmichelson/forward-loop/main/global_datastores.c
URL: http://svn.digium.com/view/asterisk/team/mmichelson/forward-loop/main/global_datastores.c?view=diff&rev=87054&r1=87053&r2=87054
==============================================================================
--- team/mmichelson/forward-loop/main/global_datastores.c (original)
+++ team/mmichelson/forward-loop/main/global_datastores.c Thu Oct 25 14:44:10 2007
@@ -11,11 +11,11 @@
 
 	AST_LIST_LOCK(dialed_interface_list);
 	while ((di = AST_LIST_REMOVE_HEAD(dialed_interface_list, list)))
-		free(di);
+		ast_free(di);
 	AST_LIST_UNLOCK(dialed_interface_list);
 
 	AST_LIST_HEAD_DESTROY(dialed_interface_list);
-	free(dialed_interface_list);
+	ast_free(dialed_interface_list);
 }
 
 static void *dialed_interface_duplicate(void *data)




More information about the asterisk-commits mailing list