[asterisk-commits] trunk - r8379 /trunk/apps/

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Sat Jan 21 01:13:20 MST 2006


Author: russell
Date: Sat Jan 21 02:13:12 2006
New Revision: 8379

URL: http://svn.digium.com/view/asterisk?rev=8379&view=rev
Log:
remove lots of useless checks of the result of ast_strdupa

Modified:
    trunk/apps/app_authenticate.c
    trunk/apps/app_chanspy.c
    trunk/apps/app_curl.c
    trunk/apps/app_db.c
    trunk/apps/app_dial.c
    trunk/apps/app_dictate.c
    trunk/apps/app_directory.c
    trunk/apps/app_disa.c
    trunk/apps/app_exec.c
    trunk/apps/app_externalivr.c
    trunk/apps/app_festival.c
    trunk/apps/app_hasnewvoicemail.c
    trunk/apps/app_image.c
    trunk/apps/app_macro.c
    trunk/apps/app_meetme.c
    trunk/apps/app_mixmonitor.c
    trunk/apps/app_osplookup.c
    trunk/apps/app_page.c
    trunk/apps/app_playback.c
    trunk/apps/app_privacy.c
    trunk/apps/app_queue.c
    trunk/apps/app_random.c
    trunk/apps/app_read.c
    trunk/apps/app_readfile.c
    trunk/apps/app_realtime.c
    trunk/apps/app_record.c
    trunk/apps/app_sayunixtime.c
    trunk/apps/app_senddtmf.c
    trunk/apps/app_sendtext.c
    trunk/apps/app_setcallerid.c
    trunk/apps/app_skel.c
    trunk/apps/app_stack.c
    trunk/apps/app_talkdetect.c
    trunk/apps/app_transfer.c
    trunk/apps/app_url.c
    trunk/apps/app_userevent.c
    trunk/apps/app_verbose.c
    trunk/apps/app_voicemail.c
    trunk/apps/app_while.c
    trunk/apps/app_zapras.c

Modified: trunk/apps/app_authenticate.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_authenticate.c?rev=8379&r1=8378&r2=8379&view=diff
==============================================================================
--- trunk/apps/app_authenticate.c (original)
+++ trunk/apps/app_authenticate.c Sat Jan 21 02:13:12 2006
@@ -129,11 +129,6 @@
 	}
 	
 	argcopy = ast_strdupa(data);
-	if (!argcopy) {
-		ast_log(LOG_ERROR, "Out of memory!\n");
-		LOCAL_USER_REMOVE(u);
-		return -1;
-	}
 
 	AST_STANDARD_APP_ARGS(arglist,argcopy);
 	

Modified: trunk/apps/app_chanspy.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_chanspy.c?rev=8379&r1=8378&r2=8379&view=diff
==============================================================================
--- trunk/apps/app_chanspy.c (original)
+++ trunk/apps/app_chanspy.c Sat Jan 21 02:13:12 2006
@@ -383,10 +383,7 @@
 	struct ast_flags flags;
 	signed char zero_volume = 0;
 
-	if (!(args = ast_strdupa((char *)data))) {
-		ast_log(LOG_ERROR, "Out of memory!\n");
-		return -1;
-	}
+	args = ast_strdupa(data);
 
 	LOCAL_USER_ADD(u);
 

Modified: trunk/apps/app_curl.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_curl.c?rev=8379&r1=8378&r2=8379&view=diff
==============================================================================
--- trunk/apps/app_curl.c (original)
+++ trunk/apps/app_curl.c Sat Jan 21 02:13:12 2006
@@ -129,11 +129,6 @@
 	LOCAL_USER_ACF_ADD(u);
 
 	info = ast_strdupa(data);
-	if (!info) {
-		ast_log(LOG_ERROR, "Out of memory\n");
-		LOCAL_USER_REMOVE(u);
-		return buf;
-	}
 
 	AST_STANDARD_APP_ARGS(args, info);	
 	

Modified: trunk/apps/app_db.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_db.c?rev=8379&r1=8378&r2=8379&view=diff
==============================================================================
--- trunk/apps/app_db.c (original)
+++ trunk/apps/app_db.c Sat Jan 21 02:13:12 2006
@@ -76,11 +76,6 @@
 	LOCAL_USER_ADD(u);
 
 	argv = ast_strdupa(data);
-	if (!argv) {
-		ast_log(LOG_ERROR, "Memory allocation failed\n");
-		LOCAL_USER_REMOVE(u);
-		return 0;
-	}
 
 	if (strchr(argv, '/')) {
 		family = strsep(&argv, "/");
@@ -122,11 +117,6 @@
 	LOCAL_USER_ADD(u);
 
 	argv = ast_strdupa(data);
-	if (!argv) {
-		ast_log (LOG_ERROR, "Memory allocation failed\n");
-		LOCAL_USER_REMOVE(u);
-		return 0;
-	}
 
 	if (strchr(argv, '/')) {
 		family = strsep(&argv, "/");

Modified: trunk/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_dial.c?rev=8379&r1=8378&r2=8379&view=diff
==============================================================================
--- trunk/apps/app_dial.c (original)
+++ trunk/apps/app_dial.c Sat Jan 21 02:13:12 2006
@@ -786,11 +786,7 @@
 
 	LOCAL_USER_ADD(u);
 
-	if (!(parse = ast_strdupa(data))) {
-		ast_log(LOG_WARNING, "Memory allocation failure\n");
-		LOCAL_USER_REMOVE(u);
-		return -1;
-	}
+	parse = ast_strdupa(data);
 	
 	AST_STANDARD_APP_ARGS(args, parse);
 
@@ -1628,11 +1624,6 @@
 	LOCAL_USER_ADD(u);
 
 	announce = ast_strdupa(data);	
-	if (!announce) {	
-		ast_log(LOG_ERROR, "Out of memory!\n");
-		LOCAL_USER_REMOVE(u);
-		return -1;
-	}
 	
 	memset(&peerflags, 0, sizeof(peerflags));
 

Modified: trunk/apps/app_dictate.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_dictate.c?rev=8379&r1=8378&r2=8379&view=diff
==============================================================================
--- trunk/apps/app_dictate.c (original)
+++ trunk/apps/app_dictate.c Sat Jan 21 02:13:12 2006
@@ -111,10 +111,6 @@
 	snprintf(dftbase, sizeof(dftbase), "%s/dictate", ast_config_AST_SPOOL_DIR);
 	if (!ast_strlen_zero(data)) {
 		parse = ast_strdupa(data);
-		if (!parse) {
-			ast_log(LOG_ERROR, "Out of memory!\n");
-			return -1;
-		}
 		AST_STANDARD_APP_ARGS(args, parse);
 	} else
 		args.argc = 0;

Modified: trunk/apps/app_directory.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_directory.c?rev=8379&r1=8378&r2=8379&view=diff
==============================================================================
--- trunk/apps/app_directory.c (original)
+++ trunk/apps/app_directory.c Sat Jan 21 02:13:12 2006
@@ -433,12 +433,6 @@
 
 	parse = ast_strdupa(data);
 
-	if (!parse) {
-		ast_log(LOG_ERROR, "Out of memory!\n");
-		LOCAL_USER_REMOVE(u);
-		return -1; 
-	}
-
 	AST_STANDARD_APP_ARGS(args, parse);
 		
 	if (args.options) {

Modified: trunk/apps/app_disa.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_disa.c?rev=8379&r1=8378&r2=8379&view=diff
==============================================================================
--- trunk/apps/app_disa.c (original)
+++ trunk/apps/app_disa.c Sat Jan 21 02:13:12 2006
@@ -162,11 +162,6 @@
 	ast_log(LOG_DEBUG, "Responsetimeout: %d\n", firstdigittimeout);
 
 	tmp = ast_strdupa(data);
-	if (!tmp) {
-		ast_log(LOG_ERROR, "Out of memory\n");
-		LOCAL_USER_REMOVE(u);
-		return -1;
-	}	
 
 	AST_STANDARD_APP_ARGS(args, tmp);
 

Modified: trunk/apps/app_exec.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_exec.c?rev=8379&r1=8378&r2=8379&view=diff
==============================================================================
--- trunk/apps/app_exec.c (original)
+++ trunk/apps/app_exec.c Sat Jan 21 02:13:12 2006
@@ -73,27 +73,22 @@
 
 	/* Check and parse arguments */
 	if (data) {
-		s = ast_strdupa((char *)data);
+		s = ast_strdupa(data);
+		appname = strsep(&s, "(");
 		if (s) {
-			appname = strsep(&s, "(");
-			if (s) {
-				endargs = strrchr(s, ')');
-				if (endargs)
-					*endargs = '\0';
-				pbx_substitute_variables_helper(chan, s, args, MAXRESULT - 1);
+			endargs = strrchr(s, ')');
+			if (endargs)
+				*endargs = '\0';
+			pbx_substitute_variables_helper(chan, s, args, MAXRESULT - 1);
+		}
+		if (appname) {
+			app = pbx_findapp(appname);
+			if (app) {
+				res = pbx_exec(chan, app, args, 1);
+			} else {
+				ast_log(LOG_WARNING, "Could not find application (%s)\n", appname);
+				res = -1;
 			}
-			if (appname) {
-				app = pbx_findapp(appname);
-				if (app) {
-					res = pbx_exec(chan, app, args, 1);
-				} else {
-					ast_log(LOG_WARNING, "Could not find application (%s)\n", appname);
-					res = -1;
-				}
-			}
-		} else {
-			ast_log(LOG_ERROR, "Out of memory\n");
-			res = -1;
 		}
 	}
 

Modified: trunk/apps/app_externalivr.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_externalivr.c?rev=8379&r1=8378&r2=8379&view=diff
==============================================================================
--- trunk/apps/app_externalivr.c (original)
+++ trunk/apps/app_externalivr.c Sat Jan 21 02:13:12 2006
@@ -272,11 +272,6 @@
 	}
 
 	buf = ast_strdupa(data);
-	if (!buf) {
-		ast_log(LOG_ERROR, "Out of memory!\n");
-		LOCAL_USER_REMOVE(u);
-		return -1;
-	}
 
 	argc = ast_app_separate_args(buf, '|', argv, sizeof(argv) / sizeof(argv[0]));
 

Modified: trunk/apps/app_festival.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_festival.c?rev=8379&r1=8378&r2=8379&view=diff
==============================================================================
--- trunk/apps/app_festival.c (original)
+++ trunk/apps/app_festival.c Sat Jan 21 02:13:12 2006
@@ -340,12 +340,6 @@
 	}
 	
 	data = ast_strdupa(vdata);
-	if (!data) {
-		ast_log(LOG_ERROR, "Out of memery\n");
-		ast_config_destroy(cfg);
-		LOCAL_USER_REMOVE(u);
-		return -1;
-	}
 
 	intstr = strchr(data, '|');
 	if (intstr) {	

Modified: trunk/apps/app_hasnewvoicemail.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_hasnewvoicemail.c?rev=8379&r1=8378&r2=8379&view=diff
==============================================================================
--- trunk/apps/app_hasnewvoicemail.c (original)
+++ trunk/apps/app_hasnewvoicemail.c Sat Jan 21 02:13:12 2006
@@ -130,11 +130,6 @@
 	LOCAL_USER_ADD(u);
 
 	input = ast_strdupa((char *)data);
-	if (! input) {
-		ast_log(LOG_ERROR, "Out of memory error\n");
-		LOCAL_USER_REMOVE(u);
-		return -1;
-	}
 
 	AST_STANDARD_APP_ARGS(args, input);
 
@@ -194,11 +189,6 @@
 	buf[0] = '\0';
 
 	argsstr = ast_strdupa(data);
-	if (!argsstr) {
-		ast_log(LOG_ERROR, "Out of memory");
-		LOCAL_USER_REMOVE(u);
-		return buf;
-	}
 
 	AST_STANDARD_APP_ARGS(args, argsstr);
 

Modified: trunk/apps/app_image.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_image.c?rev=8379&r1=8378&r2=8379&view=diff
==============================================================================
--- trunk/apps/app_image.c (original)
+++ trunk/apps/app_image.c Sat Jan 21 02:13:12 2006
@@ -78,11 +78,7 @@
 	
 	LOCAL_USER_ADD(u);
 
-	if (!(parse = ast_strdupa(data))) {
-		ast_log(LOG_WARNING, "Memory Error!\n");
-		LOCAL_USER_REMOVE(u);
-		return -1;
-	}
+	parse = ast_strdupa(data);
 
 	AST_STANDARD_APP_ARGS(args, parse);
 

Modified: trunk/apps/app_macro.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_macro.c?rev=8379&r1=8378&r2=8379&view=diff
==============================================================================
--- trunk/apps/app_macro.c (original)
+++ trunk/apps/app_macro.c Sat Jan 21 02:13:12 2006
@@ -308,11 +308,6 @@
 	LOCAL_USER_ADD(u);
 
 	expr = ast_strdupa(data);
-	if (!expr) {
-		ast_log(LOG_ERROR, "Out of Memory!\n");
-		LOCAL_USER_REMOVE(u);
-		return -1;
-	}
 
 	if ((label_a = strchr(expr, '?'))) {
 		*label_a = '\0';

Modified: trunk/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_meetme.c?rev=8379&r1=8378&r2=8379&view=diff
==============================================================================
--- trunk/apps/app_meetme.c (original)
+++ trunk/apps/app_meetme.c Sat Jan 21 02:13:12 2006
@@ -1779,10 +1779,6 @@
 					continue;
 				
 				parse = ast_strdupa(var->value);
-				if (!parse) {
-					ast_log(LOG_ERROR, "Out of Memory!\n");
-					return NULL;
-				}
 				
 				AST_STANDARD_APP_ARGS(args, parse);
 				if (!strcasecmp(args.confno, confno)) {
@@ -1839,11 +1835,6 @@
 	LOCAL_USER_ADD(u);
 	
 	localdata = ast_strdupa(data);
-	if (!localdata) {
-		ast_log(LOG_ERROR, "Out of memory!\n");
-		LOCAL_USER_REMOVE(u);
-		return -1;
-	}
 
 	AST_STANDARD_APP_ARGS(args, localdata);
 	

Modified: trunk/apps/app_mixmonitor.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_mixmonitor.c?rev=8379&r1=8378&r2=8379&view=diff
==============================================================================
--- trunk/apps/app_mixmonitor.c (original)
+++ trunk/apps/app_mixmonitor.c Sat Jan 21 02:13:12 2006
@@ -333,11 +333,7 @@
 
 	LOCAL_USER_ADD(u);
 
-	if (!(parse = ast_strdupa(data))) {
-		ast_log(LOG_WARNING, "Memory Error!\n");
-		LOCAL_USER_REMOVE(u);
-		return -1;
-	}
+	parse = ast_strdupa(data);
 
 	AST_STANDARD_APP_ARGS(args, parse);
 	

Modified: trunk/apps/app_osplookup.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_osplookup.c?rev=8379&r1=8378&r2=8379&view=diff
==============================================================================
--- trunk/apps/app_osplookup.c (original)
+++ trunk/apps/app_osplookup.c Sat Jan 21 02:13:12 2006
@@ -139,11 +139,6 @@
 	LOCAL_USER_ADD(u);
 
 	temp = ast_strdupa(data);
-	if (!temp) {
-		ast_log(LOG_ERROR, "Out of memory!\n");
-		LOCAL_USER_REMOVE(u);
-		return -1;
-	}
 
 	AST_STANDARD_APP_ARGS(args, temp);
 
@@ -202,11 +197,6 @@
 	LOCAL_USER_ADD(u);
 
 	temp = ast_strdupa(data);
-	if (!temp) {
-		ast_log(LOG_ERROR, "Out of memory!\n");
-		LOCAL_USER_REMOVE(u);
-		return -1;
-	}
 
 	AST_STANDARD_APP_ARGS(args, temp);
 
@@ -276,11 +266,6 @@
 	LOCAL_USER_ADD(u);
 
 	temp = ast_strdupa(data);
-	if (!temp) {
-		ast_log(LOG_ERROR, "Out of memory!\n");
-		LOCAL_USER_REMOVE(u);
-		return -1;
-	}
 
 	AST_STANDARD_APP_ARGS(args, temp);
 

Modified: trunk/apps/app_page.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_page.c?rev=8379&r1=8378&r2=8379&view=diff
==============================================================================
--- trunk/apps/app_page.c (original)
+++ trunk/apps/app_page.c Sat Jan 21 02:13:12 2006
@@ -164,11 +164,6 @@
 	};
 
 	options = ast_strdupa(data);
-	if (!options) {
-		ast_log(LOG_ERROR, "Out of memory\n");
-		LOCAL_USER_REMOVE(u);
-		return -1;
-	}
 
 	tmp = strsep(&options, "|");
 	if (options)

Modified: trunk/apps/app_playback.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_playback.c?rev=8379&r1=8378&r2=8379&view=diff
==============================================================================
--- trunk/apps/app_playback.c (original)
+++ trunk/apps/app_playback.c Sat Jan 21 02:13:12 2006
@@ -90,10 +90,6 @@
 	}
 
 	tmp = ast_strdupa(data);
-	if (!tmp) {
-		ast_log(LOG_ERROR, "Out of memory!\n");
-		return -1;	
-	}
 
 	LOCAL_USER_ADD(u);
 	AST_STANDARD_APP_ARGS(args, tmp);

Modified: trunk/apps/app_privacy.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_privacy.c?rev=8379&r1=8378&r2=8379&view=diff
==============================================================================
--- trunk/apps/app_privacy.c (original)
+++ trunk/apps/app_privacy.c Sat Jan 21 02:13:12 2006
@@ -118,11 +118,6 @@
 		if (!ast_strlen_zero((char *)data))
 		{
 			parse = ast_strdupa(data);
-			if (!parse) {
-				ast_log(LOG_ERROR, "Out of memory!\n");
-				LOCAL_USER_REMOVE(u);
-				return -1;
-			}
 			
 			AST_STANDARD_APP_ARGS(args, parse);
 

Modified: trunk/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_queue.c?rev=8379&r1=8378&r2=8379&view=diff
==============================================================================
--- trunk/apps/app_queue.c (original)
+++ trunk/apps/app_queue.c Sat Jan 21 02:13:12 2006
@@ -2645,11 +2645,7 @@
 
 	LOCAL_USER_ADD(u);
 
-	if (!(parse = ast_strdupa(data))) {
-		ast_log(LOG_WARNING, "Memory Error!\n");
-		LOCAL_USER_REMOVE(u);
-		return -1;
-	}
+	parse = ast_strdupa(data);
 
 	AST_STANDARD_APP_ARGS(args, parse);
 
@@ -2701,11 +2697,7 @@
 
 	LOCAL_USER_ADD(u);
 
-	if (!(parse = ast_strdupa(data))) {
-		ast_log(LOG_WARNING, "Memory Error!\n");
-		LOCAL_USER_REMOVE(u);
-		return -1;
-	}
+	parse = ast_strdupa(data);
 
 	AST_STANDARD_APP_ARGS(args, parse);
 
@@ -2759,11 +2751,7 @@
 
 	LOCAL_USER_ADD(u);
 
-	if (!(parse = ast_strdupa(data))) {
-		ast_log(LOG_WARNING, "Memory Error!\n");
-		LOCAL_USER_REMOVE(u);
-		return -1;
-	}
+	parse = ast_strdupa(data);
 
 	AST_STANDARD_APP_ARGS(args, parse);
 

Modified: trunk/apps/app_random.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_random.c?rev=8379&r1=8378&r2=8379&view=diff
==============================================================================
--- trunk/apps/app_random.c (original)
+++ trunk/apps/app_random.c Sat Jan 21 02:13:12 2006
@@ -74,11 +74,6 @@
 	LOCAL_USER_ADD(u);
 
 	s = ast_strdupa(data);
-	if (!s) {
-		ast_log(LOG_ERROR, "Out of memory!\n");
-		LOCAL_USER_REMOVE(u);
-		return -1;
-	}
 
 	prob = strsep(&s,":");
 	if ((!prob) || (sscanf(prob, "%d", &probint) != 1))

Modified: trunk/apps/app_read.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_read.c?rev=8379&r1=8378&r2=8379&view=diff
==============================================================================
--- trunk/apps/app_read.c (original)
+++ trunk/apps/app_read.c Sat Jan 21 02:13:12 2006
@@ -118,11 +118,6 @@
 	LOCAL_USER_ADD(u);
 	
 	argcopy = ast_strdupa(data);
-	if (!argcopy) {
-		ast_log(LOG_ERROR, "Out of memory!\n");
-		LOCAL_USER_REMOVE(u);
-		return -1;
-	}
 
 	AST_STANDARD_APP_ARGS(arglist, argcopy);
 

Modified: trunk/apps/app_readfile.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_readfile.c?rev=8379&r1=8378&r2=8379&view=diff
==============================================================================
--- trunk/apps/app_readfile.c (original)
+++ trunk/apps/app_readfile.c Sat Jan 21 02:13:12 2006
@@ -74,11 +74,6 @@
 	LOCAL_USER_ADD(u);
 
 	s = ast_strdupa(data);
-	if (!s) {
-		ast_log(LOG_ERROR, "Out of memory\n");
-		LOCAL_USER_REMOVE(u);
-		return -1;
-	}
 
 	varname = strsep(&s, "=");
 	file = strsep(&s, "|");

Modified: trunk/apps/app_realtime.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_realtime.c?rev=8379&r1=8378&r2=8379&view=diff
==============================================================================
--- trunk/apps/app_realtime.c (original)
+++ trunk/apps/app_realtime.c Sat Jan 21 02:13:12 2006
@@ -148,20 +148,19 @@
 	
 	LOCAL_USER_ADD(u);
 
-	if ((family = ast_strdupa(data))) {
-		if ((colmatch = strchr(family,'|'))) {
-			crop_data(colmatch);
-			if ((value = strchr(colmatch,'|'))) {
-				crop_data(value);
-				if ((newcol = strchr(value,'|'))) {
-					crop_data(newcol);
-					if ((newval = strchr(newcol,'|'))) 
-						crop_data(newval);
-				}
+	family = ast_strdupa(data);
+	if ((colmatch = strchr(family,'|'))) {
+		crop_data(colmatch);
+		if ((value = strchr(colmatch,'|'))) {
+			crop_data(value);
+			if ((newcol = strchr(value,'|'))) {
+				crop_data(newcol);
+				if ((newval = strchr(newcol,'|'))) 
+					crop_data(newval);
 			}
 		}
 	}
-	if (! (family && value && colmatch && newcol && newval) ) {
+	if (!newval) {
 		ast_log(LOG_ERROR,"Invalid input: usage %s\n",UUSAGE);
 		res = -1;
 	} else {
@@ -193,17 +192,16 @@
 	
 	LOCAL_USER_ADD(u);
 
-	if ((family = ast_strdupa(data))) {
-		if ((colmatch = strchr(family,'|'))) {
-			crop_data(colmatch);
-			if ((value = strchr(colmatch,'|'))) {
-				crop_data(value);
-				if ((prefix = strchr(value,'|')))
-					crop_data(prefix);
-			}
+	family = ast_strdupa(data);
+	if ((colmatch = strchr(family,'|'))) {
+		crop_data(colmatch);
+		if ((value = strchr(colmatch,'|'))) {
+			crop_data(value);
+			if ((prefix = strchr(value,'|')))
+				crop_data(prefix);
 		}
 	}
-	if (! (family && value && colmatch) ) {
+	if (!value) {
 		ast_log(LOG_ERROR,"Invalid input: usage %s\n",USAGE);
 		res = -1;
 	} else {

Modified: trunk/apps/app_record.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_record.c?rev=8379&r1=8378&r2=8379&view=diff
==============================================================================
--- trunk/apps/app_record.c (original)
+++ trunk/apps/app_record.c Sat Jan 21 02:13:12 2006
@@ -117,11 +117,6 @@
 
 	/* Yay for strsep being easy */
 	vdata = ast_strdupa(data);
-	if (!vdata) {
-		ast_log(LOG_ERROR, "Out of memory\n");
-		LOCAL_USER_REMOVE(u);
-		return -1;
-	}
 
 	p = vdata;
 	filename = strsep(&p, "|");

Modified: trunk/apps/app_sayunixtime.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_sayunixtime.c?rev=8379&r1=8378&r2=8379&view=diff
==============================================================================
--- trunk/apps/app_sayunixtime.c (original)
+++ trunk/apps/app_sayunixtime.c Sat Jan 21 02:13:12 2006
@@ -92,26 +92,21 @@
 	} 
 
 	if (data) {
-		s = data;
-		s = ast_strdupa(s);
+		s = ast_strdupa(data);
+		timec = strsep(&s,"|");
+		if ((timec) && (*timec != '\0')) {
+			long timein;
+			if (sscanf(timec,"%ld",&timein) == 1) {
+				unixtime = (time_t)timein;
+			}
+		}
 		if (s) {
-			timec = strsep(&s,"|");
-			if ((timec) && (*timec != '\0')) {
-				long timein;
-				if (sscanf(timec,"%ld",&timein) == 1) {
-					unixtime = (time_t)timein;
-				}
+			zone = strsep(&s,"|");
+			if (zone && (*zone == '\0'))
+				zone = NULL;
+			if (s) {
+				format = s;
 			}
-			if (s) {
-				zone = strsep(&s,"|");
-				if (zone && (*zone == '\0'))
-					zone = NULL;
-				if (s) {
-					format = s;
-				}
-			}
-		} else {
-			ast_log(LOG_ERROR, "Out of memory error\n");
 		}
 	}
 

Modified: trunk/apps/app_senddtmf.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_senddtmf.c?rev=8379&r1=8378&r2=8379&view=diff
==============================================================================
--- trunk/apps/app_senddtmf.c (original)
+++ trunk/apps/app_senddtmf.c Sat Jan 21 02:13:12 2006
@@ -75,11 +75,6 @@
 	LOCAL_USER_ADD(u);
 
 	digits = ast_strdupa(data);
-	if (!digits) {
-		ast_log(LOG_ERROR, "Out of Memory!\n");
-		LOCAL_USER_REMOVE(u);
-		return -1;
-	}
 
 	if ((to = strchr(digits,'|'))) {
 		*to = '\0';

Modified: trunk/apps/app_sendtext.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_sendtext.c?rev=8379&r1=8378&r2=8379&view=diff
==============================================================================
--- trunk/apps/app_sendtext.c (original)
+++ trunk/apps/app_sendtext.c Sat Jan 21 02:13:12 2006
@@ -87,14 +87,8 @@
 		ast_log(LOG_WARNING, "SendText requires an argument (text[|options])\n");
 		LOCAL_USER_REMOVE(u);
 		return -1;
-	} else {
+	} else
 		parse = ast_strdupa(data);
-		if (!parse) {
-			ast_log(LOG_ERROR, "Out of memory!\n");
-			LOCAL_USER_REMOVE(u);
-			return -1;
-		}
-	}
 	
 	AST_STANDARD_APP_ARGS(args, parse);
 

Modified: trunk/apps/app_setcallerid.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_setcallerid.c?rev=8379&r1=8378&r2=8379&view=diff
==============================================================================
--- trunk/apps/app_setcallerid.c (original)
+++ trunk/apps/app_setcallerid.c Sat Jan 21 02:13:12 2006
@@ -118,11 +118,6 @@
 	LOCAL_USER_ADD(u);
 	
 	tmp = ast_strdupa(data);
-	if (!tmp) {
-		ast_log(LOG_ERROR, "Out of memory\n");
-		LOCAL_USER_REMOVE(u);
-		return -1;
-	}
 	
 	opt = strchr(tmp, '|');
 	if (opt) {

Modified: trunk/apps/app_skel.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_skel.c?rev=8379&r1=8378&r2=8379&view=diff
==============================================================================
--- trunk/apps/app_skel.c (original)
+++ trunk/apps/app_skel.c Sat Jan 21 02:13:12 2006
@@ -88,11 +88,6 @@
 
 	/* We need to make a copy of the input string if we are going to modify it! */
 	args = ast_strdupa(data);	
-	if (!args) {
-		ast_log(LOG_ERROR, "Out of memory!\n");
-		LOCAL_USER_REMOVE(u);
-		return -1;
-	}
 	
 	if ((argc = ast_app_separate_args(args, '|', argv, sizeof(argv) / sizeof(argv[0])))) {
 		dummy = argv[0];

Modified: trunk/apps/app_stack.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_stack.c?rev=8379&r1=8378&r2=8379&view=diff
==============================================================================
--- trunk/apps/app_stack.c (original)
+++ trunk/apps/app_stack.c Sat Jan 21 02:13:12 2006
@@ -130,10 +130,6 @@
 	}
 
 	args = ast_strdupa((char *)data);
-	if (!args) {
-		ast_log(LOG_ERROR, "Out of memory\n");
-		return -1;
-	}
 
 	LOCAL_USER_ADD(u);
 

Modified: trunk/apps/app_talkdetect.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_talkdetect.c?rev=8379&r1=8378&r2=8379&view=diff
==============================================================================
--- trunk/apps/app_talkdetect.c (original)
+++ trunk/apps/app_talkdetect.c Sat Jan 21 02:13:12 2006
@@ -89,11 +89,6 @@
 	LOCAL_USER_ADD(u);
 
 	tmp = ast_strdupa(data);
-	if (!tmp) {
-		ast_log(LOG_ERROR, "Out of memory\n");
-		LOCAL_USER_REMOVE(u);
-		return -1;
-	}	
 
 	stringp=tmp;
 	strsep(&stringp, "|");

Modified: trunk/apps/app_transfer.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_transfer.c?rev=8379&r1=8378&r2=8379&view=diff
==============================================================================
--- trunk/apps/app_transfer.c (original)
+++ trunk/apps/app_transfer.c Sat Jan 21 02:13:12 2006
@@ -88,19 +88,14 @@
 
 	LOCAL_USER_ADD(u);
 
-	if (ast_strlen_zero((char *)data)) {
+	if (ast_strlen_zero(data)) {
 		ast_log(LOG_WARNING, "Transfer requires an argument ([Tech/]destination[|options])\n");
 		LOCAL_USER_REMOVE(u);
 		pbx_builtin_setvar_helper(chan, "TRANSFERSTATUS", "FAILURE");
 		return 0;
-	} else {
-		parse = ast_strdupa(data);
-		if (!parse) {
-			ast_log(LOG_ERROR, "Out of memory!\n");
-			LOCAL_USER_REMOVE(u);
-			return -1;
-		}
 	}
+	
+	parse = ast_strdupa(data);
 
 	AST_STANDARD_APP_ARGS(args, parse);
 

Modified: trunk/apps/app_url.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_url.c?rev=8379&r1=8378&r2=8379&view=diff
==============================================================================
--- trunk/apps/app_url.c (original)
+++ trunk/apps/app_url.c Sat Jan 21 02:13:12 2006
@@ -94,14 +94,8 @@
 
 	LOCAL_USER_ADD(u);
 
-	tmp = ast_strdupa(data);
-	if (!tmp) {
-		ast_log(LOG_ERROR, "Out of memory\n");
-		LOCAL_USER_REMOVE(u);
-		return -1;
-	}
+	stringp = tmp = ast_strdupa(data);
 
-	stringp=tmp;
 	strsep(&stringp, "|");
 	options = strsep(&stringp, "|");
 	if (options && !strcasecmp(options, "wait"))

Modified: trunk/apps/app_userevent.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_userevent.c?rev=8379&r1=8378&r2=8379&view=diff
==============================================================================
--- trunk/apps/app_userevent.c (original)
+++ trunk/apps/app_userevent.c Sat Jan 21 02:13:12 2006
@@ -75,11 +75,6 @@
 	LOCAL_USER_ADD(u);
 
 	info = ast_strdupa(data);
-	if (!info) {
-		ast_log(LOG_ERROR, "Out of memory\n");
-		LOCAL_USER_REMOVE(u);
-		return -1;
-	}
 
 	snprintf(eventname, sizeof(eventname), "UserEvent%s", info);
 	eventbody = strchr(eventname, '|');

Modified: trunk/apps/app_verbose.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_verbose.c?rev=8379&r1=8378&r2=8379&view=diff
==============================================================================
--- trunk/apps/app_verbose.c (original)
+++ trunk/apps/app_verbose.c Sat Jan 21 02:13:12 2006
@@ -67,38 +67,34 @@
 	LOCAL_USER_ADD(u);
 
 	if (data) {
-		vtext = ast_strdupa((char *)data);
+		vtext = ast_strdupa(data);
+		char *tmp = strsep(&vtext, "|,");
 		if (vtext) {
-			char *tmp = strsep(&vtext, "|,");
-			if (vtext) {
-				if (sscanf(tmp, "%d", &vsize) != 1) {
-					vsize = 0;
-					ast_log(LOG_WARNING, "'%s' is not a verboser number\n", vtext);
-				}
-			} else {
-				vtext = tmp;
+			if (sscanf(tmp, "%d", &vsize) != 1) {
 				vsize = 0;
-			}
-			if (option_verbose >= vsize) {
-				switch (vsize) {
-				case 0:
-					ast_verbose("%s\n", vtext);
-					break;
-				case 1:
-					ast_verbose(VERBOSE_PREFIX_1 "%s\n", vtext);
-					break;
-				case 2:
-					ast_verbose(VERBOSE_PREFIX_2 "%s\n", vtext);
-					break;
-				case 3:
-					ast_verbose(VERBOSE_PREFIX_3 "%s\n", vtext);
-					break;
-				default:
-					ast_verbose(VERBOSE_PREFIX_4 "%s\n", vtext);
-				}
+				ast_log(LOG_WARNING, "'%s' is not a verboser number\n", vtext);
 			}
 		} else {
-			ast_log(LOG_ERROR, "Out of memory\n");
+			vtext = tmp;
+			vsize = 0;
+		}
+		if (option_verbose >= vsize) {
+			switch (vsize) {
+			case 0:
+				ast_verbose("%s\n", vtext);
+				break;
+			case 1:
+				ast_verbose(VERBOSE_PREFIX_1 "%s\n", vtext);
+				break;
+			case 2:
+				ast_verbose(VERBOSE_PREFIX_2 "%s\n", vtext);
+				break;
+			case 3:
+				ast_verbose(VERBOSE_PREFIX_3 "%s\n", vtext);
+				break;
+			default:
+				ast_verbose(VERBOSE_PREFIX_4 "%s\n", vtext);
+			}
 		}
 	}
 
@@ -121,11 +117,6 @@
 	}
 
 	ltext = ast_strdupa(data);
-	if (!ltext) {
-		ast_log(LOG_ERROR, "Out of memory\n");
-		LOCAL_USER_REMOVE(u);
-		return 0;
-	}
 
 	level = strsep(&ltext, "|");
 

Modified: trunk/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_voicemail.c?rev=8379&r1=8378&r2=8379&view=diff
==============================================================================
--- trunk/apps/app_voicemail.c (original)
+++ trunk/apps/app_voicemail.c Sat Jan 21 02:13:12 2006
@@ -3284,28 +3284,23 @@
 	snprintf(ext_context, sizeof(ext_context), "%s@%s", vmu->mailbox, vmu->context);
 
 	/* Attach only the first format */
-	fmt = ast_strdupa(fmt);
-	if (fmt) {
-		stringp = fmt;
-		strsep(&stringp, "|");
-
-		if (!ast_strlen_zero(vmu->email)) {
-			int attach_user_voicemail = ast_test_flag((&globalflags), VM_ATTACH);
-			char *myserveremail = serveremail;
-			attach_user_voicemail = ast_test_flag(vmu, VM_ATTACH);
-			if (!ast_strlen_zero(vmu->serveremail))
-				myserveremail = vmu->serveremail;
-			sendmail(myserveremail, vmu, msgnum, vmu->context, vmu->mailbox, cidnum, cidname, fn, fmt, duration, attach_user_voicemail, category);
-		}
-
-		if (!ast_strlen_zero(vmu->pager)) {
-			char *myserveremail = serveremail;
-			if (!ast_strlen_zero(vmu->serveremail))
-				myserveremail = vmu->serveremail;
-			sendpage(myserveremail, vmu->pager, msgnum, vmu->context, vmu->mailbox, cidnum, cidname, duration, vmu, category);
-		}
-	} else {
-		ast_log(LOG_ERROR, "Out of memory\n");
+	stringp = fmt = ast_strdupa(fmt);
+	strsep(&stringp, "|");
+
+	if (!ast_strlen_zero(vmu->email)) {
+		int attach_user_voicemail = ast_test_flag((&globalflags), VM_ATTACH);
+		char *myserveremail = serveremail;
+		attach_user_voicemail = ast_test_flag(vmu, VM_ATTACH);
+		if (!ast_strlen_zero(vmu->serveremail))
+			myserveremail = vmu->serveremail;
+		sendmail(myserveremail, vmu, msgnum, vmu->context, vmu->mailbox, cidnum, cidname, fn, fmt, duration, attach_user_voicemail, category);
+	}
+
+	if (!ast_strlen_zero(vmu->pager)) {
+		char *myserveremail = serveremail;
+		if (!ast_strlen_zero(vmu->serveremail))
+			myserveremail = vmu->serveremail;
+		sendpage(myserveremail, vmu->pager, msgnum, vmu->context, vmu->mailbox, cidnum, cidname, duration, vmu, category);
 	}
 
 	if (ast_test_flag(vmu, VM_DELETE)) {
@@ -5058,11 +5053,6 @@
 		);
 				        
 		parse = ast_strdupa(data);
-		if (!parse) {
-			ast_log(LOG_ERROR, "Out of memory!\n");
-			LOCAL_USER_REMOVE(u);
-			return -1;
-		}
 
 		AST_STANDARD_APP_ARGS(args, parse);
 
@@ -5648,11 +5638,6 @@
 	LOCAL_USER_ADD(u);
 
 	box = ast_strdupa(data);
-	if (!box) {
-		ast_log(LOG_ERROR, "Out of memory\n");
-		LOCAL_USER_REMOVE(u);
-		return -1;
-	}
 
 	AST_STANDARD_APP_ARGS(args, box);
 
@@ -5690,10 +5675,6 @@
 	
 	if (s) {
 		s = ast_strdupa(s);
-		if (!s) {
-			ast_log(LOG_ERROR, "Out of memory\n");
-			return -1;
-		}
 		user = strsep(&s, "|");
 		options = strsep(&s, "|");
 		if (user) {
@@ -6140,28 +6121,22 @@
 						if ((z = ast_malloc(sizeof(*z)))) {
 							char *msg_format, *timezone;
 							msg_format = ast_strdupa(var->value);
-							if (msg_format != NULL) {
-								timezone = strsep(&msg_format, "|");
-								if (msg_format) {
-									ast_copy_string(z->name, var->name, sizeof(z->name));
-									ast_copy_string(z->timezone, timezone, sizeof(z->timezone));
-									ast_copy_string(z->msg_format, msg_format, sizeof(z->msg_format));
-									z->next = NULL;
-									if (zones) {
-										zonesl->next = z;
-										zonesl = z;
-									} else {
-										zones = z;
-										zonesl = z;
-									}
+							timezone = strsep(&msg_format, "|");
+							if (msg_format) {
+								ast_copy_string(z->name, var->name, sizeof(z->name));
+								ast_copy_string(z->timezone, timezone, sizeof(z->timezone));
+								ast_copy_string(z->msg_format, msg_format, sizeof(z->msg_format));
+								z->next = NULL;
+								if (zones) {
+									zonesl->next = z;
+									zonesl = z;
 								} else {
-									ast_log(LOG_WARNING, "Invalid timezone definition at line %d\n", var->lineno);
-									free(z);
+									zones = z;
+									zonesl = z;
 								}
 							} else {
-								ast_log(LOG_WARNING, "Out of memory while reading voicemail config\n");
+								ast_log(LOG_WARNING, "Invalid timezone definition at line %d\n", var->lineno);
 								free(z);
-								return -1;
 							}
 						} else {						
 							return -1;

Modified: trunk/apps/app_while.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_while.c?rev=8379&r1=8378&r2=8379&view=diff
==============================================================================
--- trunk/apps/app_while.c (original)
+++ trunk/apps/app_while.c Sat Jan 21 02:13:12 2006
@@ -90,11 +90,6 @@
 	LOCAL_USER_ADD(u);
 
 	expr = ast_strdupa(data);
-	if (!expr) {
-		ast_log(LOG_ERROR, "Out of memory\n");
-		LOCAL_USER_REMOVE(u);
-		return -1;
-	}
 
 	if ((myapp = strchr(expr,'|'))) {
 		*myapp = '\0';
@@ -244,9 +239,8 @@
 	snprintf(used_index, VAR_SIZE, "%d", used_index_i);
 	snprintf(new_index, VAR_SIZE, "%d", used_index_i + 1);
 	
-	if (!end) {
-		condition = ast_strdupa((char *) data);
-	}
+	if (!end)
+		condition = ast_strdupa(data);
 
 	size = strlen(chan->context) + strlen(chan->exten) + 32;
 	my_name = alloca(size);

Modified: trunk/apps/app_zapras.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_zapras.c?rev=8379&r1=8378&r2=8379&view=diff
==============================================================================
--- trunk/apps/app_zapras.c (original)
+++ trunk/apps/app_zapras.c Sat Jan 21 02:13:12 2006
@@ -210,11 +210,6 @@
 	LOCAL_USER_ADD(u);
 
 	args = ast_strdupa(data);
-	if (!args) {
-		ast_log(LOG_ERROR, "Out of memory\n");
-		LOCAL_USER_REMOVE(u);
-		return -1;
-	}
 	
 	/* Answer the channel if it's not up */
 	if (chan->_state != AST_STATE_UP)



More information about the asterisk-commits mailing list