[svn-commits] trunk - r8380 /trunk/funcs/

svn-commits at lists.digium.com svn-commits at lists.digium.com
Sat Jan 21 01:23:59 MST 2006


Author: russell
Date: Sat Jan 21 02:23:57 2006
New Revision: 8380

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

Modified:
    trunk/funcs/func_cdr.c
    trunk/funcs/func_cut.c
    trunk/funcs/func_logic.c
    trunk/funcs/func_math.c
    trunk/funcs/func_md5.c
    trunk/funcs/func_odbc.c
    trunk/funcs/func_rand.c
    trunk/funcs/func_strings.c

Modified: trunk/funcs/func_cdr.c
URL: http://svn.digium.com/view/asterisk/trunk/funcs/func_cdr.c?rev=8380&r1=8379&r2=8380&view=diff
==============================================================================
--- trunk/funcs/func_cdr.c (original)
+++ trunk/funcs/func_cdr.c Sat Jan 21 02:23:57 2006
@@ -64,10 +64,6 @@
 		return NULL;
 
 	parse = ast_strdupa(data);
-	if (!parse) {
-		ast_log(LOG_ERROR, "Out of memory!\n");
-		return NULL;
-	}
 
 	AST_STANDARD_APP_ARGS(args, parse);
 	
@@ -93,10 +89,6 @@
 		return;
 	
 	parse = ast_strdupa(data);
-	if (!parse) {
-		ast_log(LOG_ERROR, "Out of memory!\n");
-		return;
-	}
 
 	AST_STANDARD_APP_ARGS(args, parse);
 

Modified: trunk/funcs/func_cut.c
URL: http://svn.digium.com/view/asterisk/trunk/funcs/func_cut.c?rev=8380&r1=8379&r2=8380&view=diff
==============================================================================
--- trunk/funcs/func_cut.c (original)
+++ trunk/funcs/func_cut.c Sat Jan 21 02:23:57 2006
@@ -83,10 +83,7 @@
 		return ERROR_NOARG;
 	}
 
-	strings = ast_strdupa((char *)data);
-	if (!strings) {
-		return ERROR_NOMEM;
-	}
+	strings = ast_strdupa(data);
 
 	for (ptrkey = strings; *ptrkey; ptrkey++) {
 		if (*ptrkey == '|') {
@@ -143,10 +140,6 @@
 	memset(buffer, 0, buflen); 
 	
 	parse = ast_strdupa(data);
-	if (!parse) {
-		ast_log(LOG_ERROR, "Out of memory!\n");
-		return ERROR_NOMEM;
-	}
 
 	AST_STANDARD_APP_ARGS(args, parse);
 

Modified: trunk/funcs/func_logic.c
URL: http://svn.digium.com/view/asterisk/trunk/funcs/func_logic.c?rev=8380&r1=8379&r2=8380&view=diff
==============================================================================
--- trunk/funcs/func_logic.c (original)
+++ trunk/funcs/func_logic.c Sat Jan 21 02:23:57 2006
@@ -55,10 +55,7 @@
 	char *iftrue;
 	char *iffalse;
 
-	if (!(data = ast_strdupa(data))) {
-		ast_log(LOG_WARNING, "Memory Error!\n");
-		return NULL;
-	}
+	data = ast_strdupa(data);
 
 	data = ast_strip_quoted(data, "\"", "\"");
 	expr = strsep(&data, "?");
@@ -95,10 +92,7 @@
 	char *iftrue;
 	char *iffalse;
 
-	if (!(data = ast_strdupa(data))) {
-		ast_log(LOG_WARNING, "Memory Error!\n");
-		return NULL;
-	}
+	data = ast_strdupa(data);
 
 	data = ast_strip_quoted(data, "\"", "\"");
 	expr = strsep(&data, "?");
@@ -129,10 +123,7 @@
 	char *varname;
 	char *val;
 
-	if (!(data = ast_strdupa(data))) {
-		ast_log(LOG_WARNING, "Memory Error!\n");
-		return NULL;
-	}
+	data = ast_strdupa(data);
 
 	varname = strsep(&data, "=");
 	val = data;

Modified: trunk/funcs/func_math.c
URL: http://svn.digium.com/view/asterisk/trunk/funcs/func_math.c?rev=8380&r1=8379&r2=8380&view=diff
==============================================================================
--- trunk/funcs/func_math.c (original)
+++ trunk/funcs/func_math.c Sat Jan 21 02:23:57 2006
@@ -89,10 +89,6 @@
 	}
 
 	parse = ast_strdupa(data);
-	if(!parse) {
-		ast_log(LOG_ERROR, "Out of memory!\n");
-		return NULL;
-	}
 
 	AST_STANDARD_APP_ARGS(args, parse);
 	

Modified: trunk/funcs/func_md5.c
URL: http://svn.digium.com/view/asterisk/trunk/funcs/func_md5.c?rev=8380&r1=8379&r2=8380&view=diff
==============================================================================
--- trunk/funcs/func_md5.c (original)
+++ trunk/funcs/func_md5.c Sat Jan 21 02:23:57 2006
@@ -68,10 +68,6 @@
 	}
 
 	parse = ast_strdupa(data);
-	if (!parse) {
-		ast_log(LOG_ERROR, "Out of memory!\n");
-		return NULL;
-	}
 	
 	AST_STANDARD_APP_ARGS(args, parse);
 	

Modified: trunk/funcs/func_odbc.c
URL: http://svn.digium.com/view/asterisk/trunk/funcs/func_odbc.c?rev=8380&r1=8379&r2=8380&view=diff
==============================================================================
--- trunk/funcs/func_odbc.c (original)
+++ trunk/funcs/func_odbc.c Sat Jan 21 02:23:57 2006
@@ -108,12 +108,6 @@
 		t = "";
 	}
 
-	if (!s || !t) {
-		ast_log(LOG_ERROR, "Out of memory\n");
-		ast_mutex_unlock(&query_lock);
-		return;
-	}
-
 	/* XXX You might be tempted to change this section into using
 	 * pbx_builtin_pushvar_helper().  However, note that if you try
 	 * to set a NULL (like for VALUE), then nothing gets set, and the
@@ -266,11 +260,6 @@
 
 	/* Parse our arguments */
 	s = ast_strdupa(data);
-	if (!s) {
-		ast_log(LOG_ERROR, "Out of memory\n");
-		ast_mutex_unlock(&query_lock);
-		return "";
-	}
 
 	while ((arg = strsep(&s, "|"))) {
 		count++;

Modified: trunk/funcs/func_rand.c
URL: http://svn.digium.com/view/asterisk/trunk/funcs/func_rand.c?rev=8380&r1=8379&r2=8380&view=diff
==============================================================================
--- trunk/funcs/func_rand.c (original)
+++ trunk/funcs/func_rand.c Sat Jan 21 02:23:57 2006
@@ -55,12 +55,7 @@
 
 	LOCAL_USER_ACF_ADD(u);
 
-	if (!(s = ast_strdupa(data))) {
-		ast_log(LOG_WARNING, "Out of memory\n");
-		*buffer = '\0';
-		LOCAL_USER_REMOVE(u);
-		return buffer;
-	}
+	s = ast_strdupa(data);
 
 	ast_app_separate_args(s, '|', args, sizeof(args) / sizeof(args[0]));
 

Modified: trunk/funcs/func_strings.c
URL: http://svn.digium.com/view/asterisk/trunk/funcs/func_strings.c?rev=8380&r1=8379&r2=8380&view=diff
==============================================================================
--- trunk/funcs/func_strings.c (original)
+++ trunk/funcs/func_strings.c Sat Jan 21 02:23:57 2006
@@ -52,11 +52,6 @@
 	);
 
 	parse = ast_strdupa(data);
-	if (!parse) {
-		ast_log(LOG_ERROR, "Out of memory\n");
-		ast_copy_string(buf, "0", len);
-		return buf;
-	}
 
 	AST_STANDARD_APP_ARGS(args, parse);
 	if (args.delim) {
@@ -91,10 +86,6 @@
 	char *outbuf=buf;
 
 	parse = ast_strdupa(data);
-	if (!parse) {
-		ast_log(LOG_ERROR, "Out of memory");
-		return "";
-	}
 
 	AST_STANDARD_APP_ARGS(args, parse);
 
@@ -141,10 +132,6 @@
 	ast_copy_string(buf, "0", len);
 	
 	parse = ast_strdupa(data);
-	if (!parse) {
-		ast_log(LOG_ERROR, "Out of memory in %s(%s)\n", cmd, data);
-		return buf;
-	}
 
 	AST_NONSTANDARD_APP_ARGS(args, parse, '"');
 
@@ -185,10 +172,6 @@
 
 	var = ast_strdupa(data);
 	value2 = ast_strdupa(value);
-	if (!var || !value2) {
-		ast_log(LOG_ERROR, "Out of memory\n");
-		return;
-	}
 
 	/* The functions this will generally be used with are SORT and ODBC_*, which
 	 * both return comma-delimited lists.  However, if somebody uses literal lists,
@@ -277,10 +260,6 @@
 	}
 	
 	parse = ast_strdupa(data);
-	if (!parse) {
-		ast_log(LOG_ERROR, "Out of memory\n");
-		return buf;
-	}
 	
 	AST_STANDARD_APP_ARGS(args, parse);
 



More information about the svn-commits mailing list