[asterisk-commits] trunk r21537 - /trunk/apps/app_dial.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Wed Apr 19 09:36:17 MST 2006


Author: rizzo
Date: Wed Apr 19 11:36:15 2006
New Revision: 21537

URL: http://svn.digium.com/view/asterisk?rev=21537&view=rev
Log:
more localization of variables


Modified:
    trunk/apps/app_dial.c

Modified: trunk/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_dial.c?rev=21537&r1=21536&r2=21537&view=diff
==============================================================================
--- trunk/apps/app_dial.c (original)
+++ trunk/apps/app_dial.c Wed Apr 19 11:36:15 2006
@@ -702,9 +702,7 @@
 {
 	int res = -1;
 	struct localuser *u;
-	char *tech, *number, *rest, *cur;
-	char privcid[256];
-	char privintro[1024];
+	char *rest, *cur;
 	struct dial_localuser *outgoing = NULL, *tmp;
 	struct ast_channel *peer;
 	int to;
@@ -714,10 +712,8 @@
 	int cause;
 	char numsubst[AST_MAX_EXTENSION];
 	char cidname[AST_MAX_EXTENSION];
-	char *l;
 	int privdb_val = 0;
 	unsigned int calldurationlimit = 0;
-	struct ast_bridge_config config;
 	long timelimit = 0;
 	long play_warning = 0;
 	long warning_freq = 0;
@@ -730,11 +726,11 @@
 	int play_to_caller = 0, play_to_callee = 0;
 	int sentringing = 0, moh = 0;
 	const char *outbound_group = NULL;
-	const char *macro_result = NULL;
-	char *macro_transfer_dest = NULL;
 	int digit = 0, result = 0;
-	time_t start_time, answer_time, end_time;
+	time_t start_time;
 	struct ast_app *app = NULL;
+	char privintro[1024];
+	char privcid[256];
 
 	char *parse;
 	AST_DECLARE_APP_ARGS(args,
@@ -828,13 +824,13 @@
 			play_to_caller = 1;
 		
 		var = pbx_builtin_getvar_helper(chan,"LIMIT_WARNING_FILE");
-		warning_sound = (!ast_strlen_zero(var)) ? var : "timeleft";
+		warning_sound = S_OR(var, "timeleft");
 		
 		var = pbx_builtin_getvar_helper(chan,"LIMIT_TIMEOUT_FILE");
-		end_sound = (!ast_strlen_zero(var)) ? var : NULL;
+		end_sound = S_OR(var, NULL);	/* XXX not much of a point in doing this! */
 		
 		var = pbx_builtin_getvar_helper(chan,"LIMIT_CONNECT_FILE");
-		start_sound = (!ast_strlen_zero(var)) ? var : NULL;
+		start_sound = S_OR(var, NULL);	/* XXX not much of a point in doing this! */
 
 		/* undo effect of S(x) in case they are both used */
 		calldurationlimit = 0;
@@ -863,8 +859,7 @@
 		opt_args[OPT_ARG_PRIVACY] = ast_strdupa(chan->exten);
 	if (ast_test_flag(&opts, OPT_PRIVACY) || ast_test_flag(&opts, OPT_SCREENING)) {
 		char callerid[60];
-
-		l = chan->cid.cid_num;
+		char *l = chan->cid.cid_num;	/* XXX watch out, we are overwriting it */
 		if (!ast_strlen_zero(l)) {
 			ast_shrink_phone_number(l);
 			if( ast_test_flag(&opts, OPT_PRIVACY) ) {
@@ -961,8 +956,8 @@
 	rest = args.peers;
 	while ((cur = strsep(&rest, "&")) ) {
 		/* Get a technology/[device:]number pair */
-		number = cur;
-		tech = strsep(&number, "/");
+		char *number = cur;
+		char *tech = strsep(&number, "/");
 		if (!number) {
 			ast_log(LOG_WARNING, "Dial argument takes format (technology/[device:]number1)\n");
 			goto out;
@@ -1140,7 +1135,9 @@
 			res = 0;
 		}
 	} else {
-		time(&answer_time);
+		const char *number;
+		time_t end_time, answer_time = time(NULL);
+
 		strcpy(status, "ANSWER");
 		/* Ah ha!  Someone answered within the desired timeframe.  Of course after this
 		   we will always return with -1 so that it is hung up properly after the 
@@ -1153,7 +1150,7 @@
 		if (peer->name)
 			pbx_builtin_setvar_helper(chan, "DIALEDPEERNAME", peer->name);
 
-		number = (char *)pbx_builtin_getvar_helper(peer, "DIALEDPEERNUMBER");
+		number = pbx_builtin_getvar_helper(peer, "DIALEDPEERNUMBER");
 		if (!number)
 			number = numsubst;
 		pbx_builtin_setvar_helper(chan, "DIALEDPEERNUMBER", number);
@@ -1403,7 +1400,10 @@
 			}
 
 			if (!res) {
+				const char *macro_result;
 				if ((macro_result = pbx_builtin_getvar_helper(peer, "MACRO_RESULT"))) {
+					char *macro_transfer_dest;
+
 					if (!strcasecmp(macro_result, "BUSY")) {
 						ast_copy_string(status, macro_result, sizeof(status));
 						if (ast_opt_priority_jumping || ast_test_flag(&opts, OPT_PRIORITY_JUMP)) {
@@ -1463,6 +1463,8 @@
 		}
 		
 		if (!res) {
+			struct ast_bridge_config config;
+
 			memset(&config,0,sizeof(struct ast_bridge_config));
 			if (play_to_caller)
 				ast_set_flag(&(config.features_caller), AST_FEATURE_PLAY_WARNING);



More information about the asterisk-commits mailing list