diff options
author | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-05-10 13:22:15 +0000 |
---|---|---|
committer | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-05-10 13:22:15 +0000 |
commit | d99b677f3501944b7aaf82375ef62a88e5fa3933 (patch) | |
tree | 167bf7a9b6b330883dc9bf865672132658710ffd /pbx.c | |
parent | a6b2177d50659d049694ca79f6cbe00f54dd0a93 (diff) |
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.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@26451 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'pbx.c')
-rw-r--r-- | pbx.c | 27 |
1 files changed, 11 insertions, 16 deletions
@@ -4989,8 +4989,7 @@ static int pbx_builtin_resetcdr(struct ast_channel *chan, void *data) struct ast_flags flags = { 0 }; if (!ast_strlen_zero(data)) { - if (!(args = ast_strdupa(data))) - return -1; + args = ast_strdupa(data); ast_app_parse_options(resetcdr_opts, &flags, NULL, args); } @@ -5034,16 +5033,15 @@ static int pbx_builtin_gotoiftime(struct ast_channel *chan, void *data) return -1; } - if ((s = ast_strdupa(data))) { - ts = s; + ts = s = ast_strdupa(data); - /* Separate the Goto path */ - strsep(&ts,"?"); + /* Separate the Goto path */ + strsep(&ts,"?"); - /* struct ast_include include contained garbage here, fixed by zeroing it on get_timerange */ - if (ast_build_timing(&timing, s) && ast_check_timing(&timing)) - res = pbx_builtin_goto(chan, (void *)ts); - } + /* struct ast_include include contained garbage here, fixed by zeroing it on get_timerange */ + if (ast_build_timing(&timing, s) && ast_check_timing(&timing)) + res = pbx_builtin_goto(chan, ts); + return res; } @@ -5062,8 +5060,7 @@ static int pbx_builtin_execiftime(struct ast_channel *chan, void *data) return -1; } - if (!(appname = ast_strdupa(data))) - return -1; + appname = ast_strdupa(data); s = strsep(&appname,"?"); /* Separate the timerange and application name/data */ if (!appname) { /* missing application */ @@ -5121,8 +5118,7 @@ static int pbx_builtin_waitexten(struct ast_channel *chan, void *data) ); if (!ast_strlen_zero(data)) { - if (!(parse = ast_strdupa(data))) - return -1; + parse = ast_strdupa(data); AST_STANDARD_APP_ARGS(args, parse); } else memset(&args, 0, sizeof(args)); @@ -5179,8 +5175,7 @@ static int pbx_builtin_background(struct ast_channel *chan, void *data) if (ast_strlen_zero(data)) ast_log(LOG_WARNING, "Background requires an argument (filename)\n"); - if (!(parse = ast_strdupa(data))) - return -1; + parse = ast_strdupa(data); AST_STANDARD_APP_ARGS(args, parse); |