[asterisk-commits] trunk r26451 - in /trunk: ./ apps/ channels/
funcs/ include/asterisk/ pbx/ res/
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Wed May 10 06:22:16 MST 2006
Author: russell
Date: Wed May 10 08:22:15 2006
New Revision: 26451
URL: http://svn.digium.com/view/asterisk?rev=26451&view=rev
Log:
remove almost all of the checks of the result from ast_strdupa() or alloca().
As it turns out, all of these checks were useless, because alloca will never
return NULL.
Modified:
trunk/app.c
trunk/apps/app_amd.c
trunk/apps/app_authenticate.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_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_speech_utils.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
trunk/apps/app_zapscan.c
trunk/callerid.c
trunk/channel.c
trunk/channels/chan_agent.c
trunk/channels/chan_iax2.c
trunk/channels/chan_sip.c
trunk/dsp.c
trunk/funcs/func_cut.c
trunk/include/asterisk/utils.h
trunk/indications.c
trunk/loader.c
trunk/logger.c
trunk/manager.c
trunk/netsock.c
trunk/pbx.c
trunk/pbx/pbx_dundi.c
trunk/res/res_agi.c
trunk/res/res_clioriginate.c
trunk/res/res_config_odbc.c
trunk/res/res_config_pgsql.c
trunk/res/res_convert.c
trunk/res/res_features.c
trunk/res/res_monitor.c
trunk/strcompat.c
Modified: trunk/app.c
URL: http://svn.digium.com/view/asterisk/trunk/app.c?rev=26451&r1=26450&r2=26451&view=diff
==============================================================================
--- trunk/app.c (original)
+++ trunk/app.c Wed May 10 08:22:15 2006
@@ -523,7 +523,7 @@
ast_log(LOG_DEBUG,"Recording Formats: sfmts=%s\n", fmts);
sfmt[0] = ast_strdupa(fmts);
- while((fmt = strsep(&stringp, "|"))) {
+ while ((fmt = strsep(&stringp, "|"))) {
if (fmtcnt > MAX_OTHER_FORMATS - 1) {
ast_log(LOG_WARNING, "Please increase MAX_OTHER_FORMATS in app.c\n");
break;
@@ -1092,13 +1092,12 @@
case AST_ACTION_BACKLIST:
res = 0;
c = ast_strdupa(option->adata);
- if (c) {
- while((n = strsep(&c, ";")))
- if ((res = ast_stream_and_wait(chan, n, chan->language,
- (option->action == AST_ACTION_BACKLIST) ? AST_DIGIT_ANY : "")))
- break;
- ast_stopstream(chan);
- }
+ while ((n = strsep(&c, ";"))) {
+ if ((res = ast_stream_and_wait(chan, n, chan->language,
+ (option->action == AST_ACTION_BACKLIST) ? AST_DIGIT_ANY : "")))
+ break;
+ }
+ ast_stopstream(chan);
return res;
default:
ast_log(LOG_NOTICE, "Unknown dispatch function %d, ignoring!\n", option->action);
Modified: trunk/apps/app_amd.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_amd.c?rev=26451&r1=26450&r2=26451&view=diff
==============================================================================
--- trunk/apps/app_amd.c (original)
+++ trunk/apps/app_amd.c Wed May 10 08:22:15 2006
@@ -140,12 +140,7 @@
ast_log(LOG_NOTICE, "AMD using the default parameters.\n");
} else {
/* Some arguments have been passed. Lets parse them and overwrite the defaults. */
- if (!(parse = ast_strdupa(data))) {
- ast_log(LOG_WARNING, "Memory allocation failure\n");
- pbx_builtin_setvar_helper(chan , "AMDSTATUS" , "" );
- pbx_builtin_setvar_helper(chan , "AMDCAUSE" , "" );
- return;
- }
+ parse = ast_strdupa(data);
AST_STANDARD_APP_ARGS(args, parse);
Modified: trunk/apps/app_authenticate.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_authenticate.c?rev=26451&r1=26450&r2=26451&view=diff
==============================================================================
--- trunk/apps/app_authenticate.c (original)
+++ trunk/apps/app_authenticate.c Wed May 10 08:22:15 2006
@@ -123,10 +123,7 @@
}
}
- if (!(argcopy = ast_strdupa(data))) {
- LOCAL_USER_REMOVE(u);
- return -1;
- }
+ argcopy = ast_strdupa(data);
AST_STANDARD_APP_ARGS(arglist,argcopy);
Modified: trunk/apps/app_db.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_db.c?rev=26451&r1=26450&r2=26451&view=diff
==============================================================================
--- trunk/apps/app_db.c (original)
+++ trunk/apps/app_db.c Wed May 10 08:22:15 2006
@@ -71,10 +71,7 @@
LOCAL_USER_ADD(u);
- if (!(argv = ast_strdupa(data))) {
- LOCAL_USER_REMOVE(u);
- return 0;
- }
+ argv = ast_strdupa(data);
if (strchr(argv, '/')) {
family = strsep(&argv, "/");
@@ -115,10 +112,7 @@
LOCAL_USER_ADD(u);
- if (!(argv = ast_strdupa(data))) {
- LOCAL_USER_REMOVE(u);
- return 0;
- }
+ argv = ast_strdupa(data);
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=26451&r1=26450&r2=26451&view=diff
==============================================================================
--- trunk/apps/app_dial.c (original)
+++ trunk/apps/app_dial.c Wed May 10 08:22:15 2006
@@ -787,8 +787,7 @@
LOCAL_USER_ADD(u);
- if (!(parse = ast_strdupa(data)))
- goto done;
+ parse = ast_strdupa(data);
AST_STANDARD_APP_ARGS(args, parse);
@@ -1596,8 +1595,7 @@
LOCAL_USER_ADD(u);
- if (!(announce = ast_strdupa(data)))
- goto done;
+ announce = ast_strdupa(data);
memset(&peerflags, 0, sizeof(peerflags));
Modified: trunk/apps/app_dictate.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_dictate.c?rev=26451&r1=26450&r2=26451&view=diff
==============================================================================
--- trunk/apps/app_dictate.c (original)
+++ trunk/apps/app_dictate.c Wed May 10 08:22:15 2006
@@ -107,8 +107,7 @@
snprintf(dftbase, sizeof(dftbase), "%s/dictate", ast_config_AST_SPOOL_DIR);
if (!ast_strlen_zero(data)) {
- if (!(parse = ast_strdupa(data)))
- return -1;
+ parse = ast_strdupa(data);
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=26451&r1=26450&r2=26451&view=diff
==============================================================================
--- trunk/apps/app_directory.c (original)
+++ trunk/apps/app_directory.c Wed May 10 08:22:15 2006
@@ -411,10 +411,7 @@
LOCAL_USER_ADD(u);
- if (!(parse = ast_strdupa(data))) {
- LOCAL_USER_REMOVE(u);
- return -1;
- }
+ parse = ast_strdupa(data);
AST_STANDARD_APP_ARGS(args, parse);
Modified: trunk/apps/app_disa.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_disa.c?rev=26451&r1=26450&r2=26451&view=diff
==============================================================================
--- trunk/apps/app_disa.c (original)
+++ trunk/apps/app_disa.c Wed May 10 08:22:15 2006
@@ -158,10 +158,7 @@
ast_log(LOG_DEBUG, "Digittimeout: %d\n", digittimeout);
ast_log(LOG_DEBUG, "Responsetimeout: %d\n", firstdigittimeout);
- if (!(tmp = ast_strdupa(data))) {
- LOCAL_USER_REMOVE(u);
- return -1;
- }
+ tmp = ast_strdupa(data);
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=26451&r1=26450&r2=26451&view=diff
==============================================================================
--- trunk/apps/app_exec.c (original)
+++ trunk/apps/app_exec.c Wed May 10 08:22:15 2006
@@ -80,8 +80,7 @@
"The channel variable TRYSTATUS will be set to:\n"
" SUCCESS if the application returned zero\n"
" FAILED if the application returned non-zero\n"
-" NOAPP if the application was not found or was not specified\n"
-" NOMEMORY if there was not enough memory to execute.\n";
+" NOAPP if the application was not found or was not specified\n";
static char *app_execif = "ExecIf";
static char *execif_synopsis = "Executes dialplan application, conditionally";
@@ -104,25 +103,23 @@
/* Check and parse arguments */
if (data) {
- if ((s = ast_strdupa(data))) {
- appname = strsep(&s, "(");
- if (s) {
- endargs = strrchr(s, ')');
- if (endargs)
- *endargs = '\0';
- pbx_substitute_variables_helper(chan, s, args, MAXRESULT - 1);
+ s = ast_strdupa(data);
+ appname = strsep(&s, "(");
+ if (s) {
+ 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);
+ } 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);
- } else {
- ast_log(LOG_WARNING, "Could not find application (%s)\n", appname);
- res = -1;
- }
- }
- } else
- res = -1;
+ }
}
LOCAL_USER_REMOVE(u);
@@ -140,27 +137,23 @@
/* Check and parse arguments */
if (data) {
- if ((s = ast_strdupa(data))) {
- appname = strsep(&s, "(");
- if (s) {
- endargs = strrchr(s, ')');
- if (endargs)
- *endargs = '\0';
- pbx_substitute_variables_helper(chan, s, args, MAXRESULT - 1);
+ s = ast_strdupa(data);
+ appname = strsep(&s, "(");
+ if (s) {
+ 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);
+ pbx_builtin_setvar_helper(chan, "TRYSTATUS", res ? "FAILED" : "SUCCESS");
+ } else {
+ ast_log(LOG_WARNING, "Could not find application (%s)\n", appname);
+ pbx_builtin_setvar_helper(chan, "TRYSTATUS", "NOAPP");
}
- if (appname) {
- app = pbx_findapp(appname);
- if (app) {
- res = pbx_exec(chan, app, args);
- pbx_builtin_setvar_helper(chan, "TRYSTATUS", res ? "FAILED" : "SUCCESS");
- } else {
- ast_log(LOG_WARNING, "Could not find application (%s)\n", appname);
- pbx_builtin_setvar_helper(chan, "TRYSTATUS", "NOAPP");
- }
- }
- } else {
- ast_log(LOG_ERROR, "Out of memory\n");
- pbx_builtin_setvar_helper(chan, "TRYSTATUS", "NOMEMORY");
}
}
@@ -178,10 +171,7 @@
LOCAL_USER_ADD(u);
- if (!(expr = ast_strdupa(data))) {
- LOCAL_USER_REMOVE(u);
- return -1;
- }
+ expr = ast_strdupa(data);
if ((myapp = strchr(expr,'|'))) {
*myapp = '\0';
Modified: trunk/apps/app_externalivr.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_externalivr.c?rev=26451&r1=26450&r2=26451&view=diff
==============================================================================
--- trunk/apps/app_externalivr.c (original)
+++ trunk/apps/app_externalivr.c Wed May 10 08:22:15 2006
@@ -275,10 +275,7 @@
return -1;
}
- if (!(buf = ast_strdupa(data))) {
- LOCAL_USER_REMOVE(lu);
- return -1;
- }
+ buf = ast_strdupa(data);
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=26451&r1=26450&r2=26451&view=diff
==============================================================================
--- trunk/apps/app_festival.c (original)
+++ trunk/apps/app_festival.c Wed May 10 08:22:15 2006
@@ -356,11 +356,7 @@
festivalcommand = newfestivalcommand;
}
- if (!(data = ast_strdupa(vdata))) {
- ast_config_destroy(cfg);
- LOCAL_USER_REMOVE(u);
- return -1;
- }
+ data = ast_strdupa(vdata);
intstr = strchr(data, '|');
if (intstr) {
Modified: trunk/apps/app_hasnewvoicemail.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_hasnewvoicemail.c?rev=26451&r1=26450&r2=26451&view=diff
==============================================================================
--- trunk/apps/app_hasnewvoicemail.c (original)
+++ trunk/apps/app_hasnewvoicemail.c Wed May 10 08:22:15 2006
@@ -126,10 +126,7 @@
LOCAL_USER_ADD(u);
- if (!(input = ast_strdupa(data))) {
- LOCAL_USER_REMOVE(u);
- return -1;
- }
+ input = ast_strdupa(data);
AST_STANDARD_APP_ARGS(args, input);
Modified: trunk/apps/app_image.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_image.c?rev=26451&r1=26450&r2=26451&view=diff
==============================================================================
--- trunk/apps/app_image.c (original)
+++ trunk/apps/app_image.c Wed May 10 08:22:15 2006
@@ -76,10 +76,7 @@
LOCAL_USER_ADD(u);
- if (!(parse = ast_strdupa(data))) {
- LOCAL_USER_REMOVE(u);
- return -1;
- }
+ parse = ast_strdupa(data);
AST_STANDARD_APP_ARGS(args, parse);
Modified: trunk/apps/app_mixmonitor.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_mixmonitor.c?rev=26451&r1=26450&r2=26451&view=diff
==============================================================================
--- trunk/apps/app_mixmonitor.c (original)
+++ trunk/apps/app_mixmonitor.c Wed May 10 08:22:15 2006
@@ -338,10 +338,7 @@
LOCAL_USER_ADD(u);
- if (!(parse = ast_strdupa(data))) {
- 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=26451&r1=26450&r2=26451&view=diff
==============================================================================
--- trunk/apps/app_osplookup.c (original)
+++ trunk/apps/app_osplookup.c Wed May 10 08:22:15 2006
@@ -137,11 +137,7 @@
LOCAL_USER_ADD(u);
- if (!(tmp = ast_strdupa(data))) {
- ast_log(LOG_ERROR, "Out of memory\n");
- LOCAL_USER_REMOVE(u);
- return(-1);
- }
+ tmp = ast_strdupa(data);
AST_STANDARD_APP_ARGS(args, tmp);
@@ -232,11 +228,7 @@
LOCAL_USER_ADD(u);
- if (!(tmp = ast_strdupa(data))) {
- ast_log(LOG_ERROR, "Out of memory\n");
- LOCAL_USER_REMOVE(u);
- return(-1);
- }
+ tmp = ast_strdupa(data);
AST_STANDARD_APP_ARGS(args, tmp);
@@ -382,11 +374,7 @@
LOCAL_USER_ADD(u);
- if (!(tmp = ast_strdupa(data))) {
- ast_log(LOG_ERROR, "Out of memory\n");
- LOCAL_USER_REMOVE(u);
- return(-1);
- }
+ tmp = ast_strdupa(data);
AST_STANDARD_APP_ARGS(args, tmp);
@@ -506,11 +494,7 @@
LOCAL_USER_ADD(u);
- if (!(tmp = ast_strdupa(data))) {
- ast_log(LOG_ERROR, "Out of memory\n");
- LOCAL_USER_REMOVE(u);
- return(-1);
- }
+ tmp = ast_strdupa(data);
AST_STANDARD_APP_ARGS(args, tmp);
Modified: trunk/apps/app_page.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_page.c?rev=26451&r1=26450&r2=26451&view=diff
==============================================================================
--- trunk/apps/app_page.c (original)
+++ trunk/apps/app_page.c Wed May 10 08:22:15 2006
@@ -167,10 +167,7 @@
return -1;
};
- if (!(options = ast_strdupa(data))) {
- LOCAL_USER_REMOVE(u);
- return -1;
- }
+ options = ast_strdupa(data);
ast_copy_string(originator, chan->name, sizeof(originator));
if ((tmp = strchr(originator, '-')))
Modified: trunk/apps/app_playback.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_playback.c?rev=26451&r1=26450&r2=26451&view=diff
==============================================================================
--- trunk/apps/app_playback.c (original)
+++ trunk/apps/app_playback.c Wed May 10 08:22:15 2006
@@ -167,8 +167,6 @@
a->language = "en"; /* default */
ast_log(LOG_WARNING, "try <%s> in <%s>\n", s, a->language);
lang = ast_strdupa(a->language);
- if (!lang) /* no memory! */
- return -1;
for (;;) {
for (v = ast_variable_browse(say_cfg, lang); v ; v = v->next) {
if (ast_extension_match(v->name, s)) {
@@ -401,8 +399,7 @@
return -1;
}
- if (!(tmp = ast_strdupa(data)))
- return -1;
+ tmp = ast_strdupa(data);
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=26451&r1=26450&r2=26451&view=diff
==============================================================================
--- trunk/apps/app_privacy.c (original)
+++ trunk/apps/app_privacy.c Wed May 10 08:22:15 2006
@@ -113,10 +113,7 @@
if (!ast_strlen_zero((char *)data))
{
- if (!(parse = ast_strdupa(data))) {
- LOCAL_USER_REMOVE(u);
- return -1;
- }
+ parse = ast_strdupa(data);
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=26451&r1=26450&r2=26451&view=diff
==============================================================================
--- trunk/apps/app_queue.c (original)
+++ trunk/apps/app_queue.c Wed May 10 08:22:15 2006
@@ -2769,8 +2769,7 @@
return -1;
}
- if (!(parse = ast_strdupa(data)))
- return -1;
+ parse = ast_strdupa(data);
AST_STANDARD_APP_ARGS(args, parse);
@@ -2822,8 +2821,7 @@
return -1;
}
- if (!(parse = ast_strdupa(data)))
- return -1;
+ parse = ast_strdupa(data);
AST_STANDARD_APP_ARGS(args, parse);
@@ -2877,8 +2875,7 @@
return -1;
}
- if (!(parse = ast_strdupa(data)))
- return -1;
+ parse = ast_strdupa(data);
AST_STANDARD_APP_ARGS(args, parse);
@@ -2942,8 +2939,7 @@
return -1;
}
- if (!(parse = ast_strdupa(data)))
- return -1;
+ parse = ast_strdupa(data);
AST_STANDARD_APP_ARGS(args, parse);
@@ -3029,10 +3025,6 @@
}
parse = ast_strdupa(data);
- if (!parse) {
- ast_log(LOG_ERROR, "Out of memory!\n");
- return -1;
- }
AST_STANDARD_APP_ARGS(args, parse);
LOCAL_USER_ADD(lu);
Modified: trunk/apps/app_random.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_random.c?rev=26451&r1=26450&r2=26451&view=diff
==============================================================================
--- trunk/apps/app_random.c (original)
+++ trunk/apps/app_random.c Wed May 10 08:22:15 2006
@@ -71,10 +71,7 @@
LOCAL_USER_ADD(u);
- if (!(s = ast_strdupa(data))) {
- LOCAL_USER_REMOVE(u);
- return -1;
- }
+ s = ast_strdupa(data);
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=26451&r1=26450&r2=26451&view=diff
==============================================================================
--- trunk/apps/app_read.c (original)
+++ trunk/apps/app_read.c Wed May 10 08:22:15 2006
@@ -115,10 +115,7 @@
LOCAL_USER_ADD(u);
- if (!(argcopy = ast_strdupa(data))) {
- LOCAL_USER_REMOVE(u);
- return -1;
- }
+ argcopy = ast_strdupa(data);
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=26451&r1=26450&r2=26451&view=diff
==============================================================================
--- trunk/apps/app_readfile.c (original)
+++ trunk/apps/app_readfile.c Wed May 10 08:22:15 2006
@@ -70,10 +70,7 @@
LOCAL_USER_ADD(u);
- if (!(s = ast_strdupa(data))) {
- LOCAL_USER_REMOVE(u);
- return -1;
- }
+ s = ast_strdupa(data);
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=26451&r1=26450&r2=26451&view=diff
==============================================================================
--- trunk/apps/app_realtime.c (original)
+++ trunk/apps/app_realtime.c Wed May 10 08:22:15 2006
@@ -149,16 +149,15 @@
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);
}
}
}
@@ -196,14 +195,13 @@
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) ) {
Modified: trunk/apps/app_record.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_record.c?rev=26451&r1=26450&r2=26451&view=diff
==============================================================================
--- trunk/apps/app_record.c (original)
+++ trunk/apps/app_record.c Wed May 10 08:22:15 2006
@@ -113,10 +113,7 @@
LOCAL_USER_ADD(u);
/* Yay for strsep being easy */
- if (!(vdata = ast_strdupa(data))) {
- LOCAL_USER_REMOVE(u);
- return -1;
- }
+ vdata = ast_strdupa(data);
p = vdata;
filename = strsep(&p, "|");
Modified: trunk/apps/app_sayunixtime.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_sayunixtime.c?rev=26451&r1=26450&r2=26451&view=diff
==============================================================================
--- trunk/apps/app_sayunixtime.c (original)
+++ trunk/apps/app_sayunixtime.c Wed May 10 08:22:15 2006
@@ -84,8 +84,7 @@
if (!data)
return 0;
- if (!(parse = ast_strdupa(data)))
- return -1;
+ parse = ast_strdupa(data);
LOCAL_USER_ADD(u);
Modified: trunk/apps/app_senddtmf.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_senddtmf.c?rev=26451&r1=26450&r2=26451&view=diff
==============================================================================
--- trunk/apps/app_senddtmf.c (original)
+++ trunk/apps/app_senddtmf.c Wed May 10 08:22:15 2006
@@ -73,10 +73,7 @@
LOCAL_USER_ADD(u);
- if (!(digits = ast_strdupa(data))) {
- LOCAL_USER_REMOVE(u);
- return -1;
- }
+ digits = ast_strdupa(data);
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=26451&r1=26450&r2=26451&view=diff
==============================================================================
--- trunk/apps/app_sendtext.c (original)
+++ trunk/apps/app_sendtext.c Wed May 10 08:22:15 2006
@@ -83,12 +83,8 @@
ast_log(LOG_WARNING, "SendText requires an argument (text[|options])\n");
LOCAL_USER_REMOVE(u);
return -1;
- } else {
- if (!(parse = ast_strdupa(data))) {
- LOCAL_USER_REMOVE(u);
- return -1;
- }
- }
+ } else
+ parse = ast_strdupa(data);
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=26451&r1=26450&r2=26451&view=diff
==============================================================================
--- trunk/apps/app_setcallerid.c (original)
+++ trunk/apps/app_setcallerid.c Wed May 10 08:22:15 2006
@@ -115,10 +115,7 @@
LOCAL_USER_ADD(u);
- if (!(tmp = ast_strdupa(data))) {
- LOCAL_USER_REMOVE(u);
- return -1;
- }
+ tmp = ast_strdupa(data);
opt = strchr(tmp, '|');
if (opt) {
Modified: trunk/apps/app_skel.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_skel.c?rev=26451&r1=26450&r2=26451&view=diff
==============================================================================
--- trunk/apps/app_skel.c (original)
+++ trunk/apps/app_skel.c Wed May 10 08:22:15 2006
@@ -95,10 +95,7 @@
/* Do our thing here */
/* We need to make a copy of the input string if we are going to modify it! */
- if (!(parse = ast_strdupa(data))) {
- LOCAL_USER_REMOVE(u);
- return -1;
- }
+ parse = ast_strdupa(data);
AST_STANDARD_APP_ARGS(args, parse);
Modified: trunk/apps/app_speech_utils.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_speech_utils.c?rev=26451&r1=26450&r2=26451&view=diff
==============================================================================
--- trunk/apps/app_speech_utils.c (original)
+++ trunk/apps/app_speech_utils.c Wed May 10 08:22:15 2006
@@ -327,8 +327,7 @@
struct ast_speech *speech = find_speech(chan);
char *argv[2], *args = NULL, *name = NULL, *path = NULL;
- if (!(args = ast_strdupa(data)))
- return -1;
+ args = ast_strdupa(data);
LOCAL_USER_ADD(u);
@@ -504,8 +503,7 @@
struct ast_datastore *datastore = NULL;
char *argv[2], *args = NULL, *filename = NULL, tmp[2] = "";
- if (!(args = ast_strdupa(data)))
- return -1;
+ args = ast_strdupa(data);
LOCAL_USER_ADD(u);
Modified: trunk/apps/app_stack.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_stack.c?rev=26451&r1=26450&r2=26451&view=diff
==============================================================================
--- trunk/apps/app_stack.c (original)
+++ trunk/apps/app_stack.c Wed May 10 08:22:15 2006
@@ -130,8 +130,7 @@
return 0;
}
- if (!(args = ast_strdupa(data)))
- return -1;
+ args = ast_strdupa(data);
LOCAL_USER_ADD(u);
Modified: trunk/apps/app_talkdetect.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_talkdetect.c?rev=26451&r1=26450&r2=26451&view=diff
==============================================================================
--- trunk/apps/app_talkdetect.c (original)
+++ trunk/apps/app_talkdetect.c Wed May 10 08:22:15 2006
@@ -86,10 +86,7 @@
LOCAL_USER_ADD(u);
- if (!(tmp = ast_strdupa(data))) {
- LOCAL_USER_REMOVE(u);
- return -1;
- }
+ tmp = ast_strdupa(data);
stringp=tmp;
strsep(&stringp, "|");
Modified: trunk/apps/app_transfer.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_transfer.c?rev=26451&r1=26450&r2=26451&view=diff
==============================================================================
--- trunk/apps/app_transfer.c (original)
+++ trunk/apps/app_transfer.c Wed May 10 08:22:15 2006
@@ -89,12 +89,8 @@
LOCAL_USER_REMOVE(u);
pbx_builtin_setvar_helper(chan, "TRANSFERSTATUS", "FAILURE");
return 0;
- } else {
- if (!(parse = ast_strdupa(data))) {
- LOCAL_USER_REMOVE(u);
- return -1;
- }
- }
+ } else
+ 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=26451&r1=26450&r2=26451&view=diff
==============================================================================
--- trunk/apps/app_url.c (original)
+++ trunk/apps/app_url.c Wed May 10 08:22:15 2006
@@ -92,10 +92,7 @@
LOCAL_USER_ADD(u);
- if (!(tmp = ast_strdupa(data))) {
- LOCAL_USER_REMOVE(u);
- return -1;
- }
+ tmp = ast_strdupa(data);
stringp=tmp;
strsep(&stringp, "|");
Modified: trunk/apps/app_userevent.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_userevent.c?rev=26451&r1=26450&r2=26451&view=diff
==============================================================================
--- trunk/apps/app_userevent.c (original)
+++ trunk/apps/app_userevent.c Wed May 10 08:22:15 2006
@@ -72,10 +72,7 @@
LOCAL_USER_ADD(u);
- if (!(info = ast_strdupa(data))) {
- LOCAL_USER_REMOVE(u);
- return -1;
- }
+ info = ast_strdupa(data);
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=26451&r1=26450&r2=26451&view=diff
==============================================================================
--- trunk/apps/app_verbose.c (original)
+++ trunk/apps/app_verbose.c Wed May 10 08:22:15 2006
@@ -65,34 +65,34 @@
LOCAL_USER_ADD(u);
if (data) {
- if ((vtext = ast_strdupa(data))) {
- 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;
+ char *tmp;
+ vtext = ast_strdupa(data);
+ 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);
}
- 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);
- }
+ } else {
+ 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);
}
}
}
@@ -115,10 +115,7 @@
return 0;
}
- if (!(ltext = ast_strdupa(data))) {
- LOCAL_USER_REMOVE(u);
- return 0;
- }
+ ltext = ast_strdupa(data);
level = strsep(<ext, "|");
Modified: trunk/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_voicemail.c?rev=26451&r1=26450&r2=26451&view=diff
==============================================================================
--- trunk/apps/app_voicemail.c (original)
+++ trunk/apps/app_voicemail.c Wed May 10 08:22:15 2006
@@ -3368,25 +3368,24 @@
}
/* Attach only the first format */
- if ((fmt = ast_strdupa(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);
- }
+ fmt = ast_strdupa(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);
}
if (ast_test_flag(vmu, VM_DELETE)) {
@@ -5356,10 +5355,7 @@
AST_APP_ARG(argv1);
);
- if (!(parse = ast_strdupa(data))) {
- LOCAL_USER_REMOVE(u);
- return -1;
- }
+ parse = ast_strdupa(data);
AST_STANDARD_APP_ARGS(args, parse);
@@ -5826,12 +5822,7 @@
ast_answer(chan);
if (!ast_strlen_zero(data)) {
- tmp = ast_strdupa((char *)data);
- if (!tmp) {
- ast_log(LOG_ERROR, "Out of memory\n");
- LOCAL_USER_REMOVE(u);
- return -1;
- }
+ tmp = ast_strdupa(data);
AST_STANDARD_APP_ARGS(args, tmp);
if (args.argc == 2) {
if (ast_app_parse_options(vm_app_options, &flags, opts, args.argv1)) {
@@ -5958,10 +5949,7 @@
LOCAL_USER_ADD(u);
- if (!(box = ast_strdupa(data))) {
- LOCAL_USER_REMOVE(u);
- return -1;
- }
+ box = ast_strdupa(data);
AST_STANDARD_APP_ARGS(args, box);
@@ -5998,8 +5986,7 @@
LOCAL_USER_ADD(u);
if (s) {
- if (!(s = ast_strdupa(s)))
- return -1;
+ s = ast_strdupa(s);
user = strsep(&s, "|");
options = strsep(&s, "|");
if (user) {
@@ -6471,24 +6458,21 @@
struct vm_zone *z;
if ((z = ast_malloc(sizeof(*z)))) {
char *msg_format, *timezone;
- if ((msg_format = ast_strdupa(var->value))) {
- 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));
- AST_LIST_LOCK(&zones);
- AST_LIST_INSERT_HEAD(&zones, z, list);
- AST_LIST_UNLOCK(&zones);
- } else {
- ast_log(LOG_WARNING, "Invalid timezone definition at line %d\n", var->lineno);
- free(z);
- }
+ msg_format = ast_strdupa(var->value);
+ 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));
+ AST_LIST_LOCK(&zones);
+ AST_LIST_INSERT_HEAD(&zones, z, list);
+ AST_LIST_UNLOCK(&zones);
} else {
+ ast_log(LOG_WARNING, "Invalid timezone definition at line %d\n", var->lineno);
free(z);
- return -1;
}
- } else {
+ } else {
+ free(z);
return -1;
}
var = var->next;
Modified: trunk/apps/app_while.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_while.c?rev=26451&r1=26450&r2=26451&view=diff
==============================================================================
--- trunk/apps/app_while.c (original)
+++ trunk/apps/app_while.c Wed May 10 08:22:15 2006
@@ -202,9 +202,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=26451&r1=26450&r2=26451&view=diff
==============================================================================
--- trunk/apps/app_zapras.c (original)
+++ trunk/apps/app_zapras.c Wed May 10 08:22:15 2006
@@ -215,10 +215,7 @@
LOCAL_USER_ADD(u);
- if (!(args = ast_strdupa(data))) {
- LOCAL_USER_REMOVE(u);
- return -1;
- }
+ args = ast_strdupa(data);
/* Answer the channel if it's not up */
if (chan->_state != AST_STATE_UP)
Modified: trunk/apps/app_zapscan.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_zapscan.c?rev=26451&r1=26450&r2=26451&view=diff
==============================================================================
--- trunk/apps/app_zapscan.c (original)
+++ trunk/apps/app_zapscan.c Wed May 10 08:22:15 2006
@@ -307,7 +307,7 @@
if (chan->_state != AST_STATE_UP)
ast_answer(chan);
- desired_group = ast_strdupa((char *) data);
+ desired_group = ast_strdupa(data);
if(!ast_strlen_zero(desired_group)) {
ast_verbose(VERBOSE_PREFIX_3 "Scanning for group %s\n", desired_group);
search_group = 1;
Modified: trunk/callerid.c
URL: http://svn.digium.com/view/asterisk/trunk/callerid.c?rev=26451&r1=26450&r2=26451&view=diff
==============================================================================
--- trunk/callerid.c (original)
+++ trunk/callerid.c Wed May 10 08:22:15 2006
@@ -1029,11 +1029,6 @@
char *l = NULL, *n = NULL;
tmp = ast_strdupa(buf);
- if (!tmp) {
- name[0] = '\0';
- num[0] = '\0';
- return -1;
- }
ast_callerid_parse(tmp, &n, &l);
if (n)
ast_copy_string(name, n, namelen);
Modified: trunk/channel.c
URL: http://svn.digium.com/view/asterisk/trunk/channel.c?rev=26451&r1=26450&r2=26451&view=diff
==============================================================================
--- trunk/channel.c (original)
+++ trunk/channel.c Wed May 10 08:22:15 2006
@@ -1597,11 +1597,8 @@
} *fdmap;
sz = n * AST_MAX_FDS + nfds;
- if (!(pfds = alloca(sizeof(*pfds) * sz)) || !(fdmap = alloca(sizeof(*fdmap) * sz))) {
- ast_log(LOG_ERROR, "Out of memory\n");
- *outfd = -1;
- return NULL;
- }
+ pfds = alloca(sizeof(*pfds) * sz);
+ fdmap = alloca(sizeof(*fdmap) * sz);
if (outfd)
*outfd = -99999;
@@ -3773,8 +3770,6 @@
ast_group_t group = 0;
c = ast_strdupa(s);
- if (!c)
- return 0;
while ((piece = strsep(&c, ","))) {
if (sscanf(piece, "%d-%d", &start, &finish) == 2) {
Modified: trunk/channels/chan_agent.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_agent.c?rev=26451&r1=26450&r2=26451&view=diff
==============================================================================
--- trunk/channels/chan_agent.c (original)
+++ trunk/channels/chan_agent.c Wed May 10 08:22:15 2006
@@ -294,8 +294,7 @@
char *agt = NULL;
struct agent_pvt *p;
- if (!(parse = ast_strdupa(agent)))
- return NULL;
+ parse = ast_strdupa(agent);
/* Extract username (agt), password and name from agent (args). */
AST_NONSTANDARD_APP_ARGS(args, parse, ',');
@@ -1751,10 +1750,7 @@
LOCAL_USER_ADD(u);
- if (!(parse = ast_strdupa(data))) {
- LOCAL_USER_REMOVE(u);
- return -1;
- }
+ parse = ast_strdupa(data);
AST_STANDARD_APP_ARGS(args, parse);
@@ -2486,8 +2482,7 @@
return -1;
}
- if (!(parse = ast_strdupa(data)))
- return -1;
+ parse = ast_strdupa(data);
AST_NONSTANDARD_APP_ARGS(args, parse, ':');
if (!args.item)
Modified: trunk/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_iax2.c?rev=26451&r1=26450&r2=26451&view=diff
==============================================================================
--- trunk/channels/chan_iax2.c (original)
+++ trunk/channels/chan_iax2.c Wed May 10 08:22:15 2006
@@ -2969,12 +2969,10 @@
char *key = NULL;
family = ast_strdupa(peer->dbsecret);
- if (family) {
- key = strchr(family, '/');
- if (key)
- *key++ = '\0';
- }
- if (!family || !key || ast_db_get(family, key, cai->secret, sizeof(cai->secret))) {
+ key = strchr(family, '/');
+ if (key)
+ *key++ = '\0';
+ if (!key || ast_db_get(family, key, cai->secret, sizeof(cai->secret))) {
ast_log(LOG_WARNING, "Unable to retrieve database password for family/key '%s'!\n", peer->dbsecret);
if (ast_test_flag(peer, IAX_TEMPONLY))
destroy_peer(peer);
@@ -4078,7 +4076,7 @@
tmppw = ast_strdupa(iaxs[callno]->secret);
stringp = tmppw;
- while((tmppw = strsep(&stringp, ";"))) {
+ while ((tmppw = strsep(&stringp, ";"))) {
MD5Init(&md5);
MD5Update(&md5, (unsigned char *)iaxs[callno]->challenge, strlen(iaxs[callno]->challenge));
MD5Update(&md5, (unsigned char *)tmppw, strlen(tmppw));
@@ -5132,14 +5130,12 @@
if (!ast_strlen_zero(user->dbsecret)) {
char *family, *key=NULL;
family = ast_strdupa(user->dbsecret);
- if (family) {
- key = strchr(family, '/');
- if (key) {
- *key = '\0';
- key++;
- }
+ key = strchr(family, '/');
+ if (key) {
+ *key = '\0';
+ key++;
}
[... 710 lines stripped ...]
More information about the asterisk-commits
mailing list