diff options
author | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-01-21 00:42:25 +0000 |
---|---|---|
committer | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-01-21 00:42:25 +0000 |
commit | 708a7ca40ebcaac8a62cdac9eebd3326116ea1d8 (patch) | |
tree | 025deea905f3616996d9949bb02df38a4bdd19ca /pbx.c | |
parent | 8243b0f682681e4244021c772b42485e97910d8f (diff) |
remove some useless checks after calls to ast_strdupa
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@8362 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'pbx.c')
-rw-r--r-- | pbx.c | 46 |
1 files changed, 12 insertions, 34 deletions
@@ -1220,10 +1220,6 @@ char *ast_func_read(struct ast_channel *chan, const char *in, char *workspace, s struct ast_custom_function *acfptr; function = ast_strdupa(in); - if (!function) { - ast_log(LOG_ERROR, "Out of memory\n"); - return ret; - } if ((args = strchr(function, '('))) { *args = '\0'; args++; @@ -1255,10 +1251,6 @@ void ast_func_write(struct ast_channel *chan, const char *in, const char *value) struct ast_custom_function *acfptr; function = ast_strdupa(in); - if (!function) { - ast_log(LOG_ERROR, "Out of memory\n"); - return; - } if ((args = strchr(function, '('))) { *args = '\0'; args++; @@ -3349,7 +3341,7 @@ static int handle_show_dialplan(int fd, int argc, char *argv[]) if (argc == 3) { char *splitter = ast_strdupa(argv[2]); /* is there a '@' character? */ - if (splitter && strchr(argv[2], '@')) { + if (strchr(argv[2], '@')) { /* yes, split into exten & context ... */ exten = strsep(&splitter, "@"); context = splitter; @@ -5146,10 +5138,6 @@ static int pbx_builtin_resetcdr(struct ast_channel *chan, void *data) if (!ast_strlen_zero(data)) { args = ast_strdupa(data); - if (!args) { - ast_log(LOG_ERROR, "Out of memory!\n"); - return -1; - } ast_app_parse_options(resetcdr_opts, &flags, NULL, args); } @@ -5187,7 +5175,7 @@ static int pbx_builtin_hangup(struct ast_channel *chan, void *data) */ static int pbx_builtin_gotoiftime(struct ast_channel *chan, void *data) { - int res=0; + int res = 0; char *s, *ts; struct ast_timing timing; @@ -5196,18 +5184,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); - } else { - ast_log(LOG_ERROR, "Memory Error!\n"); - } + /* 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); + return res; } @@ -5227,17 +5212,11 @@ static int pbx_builtin_execiftime(struct ast_channel *chan, void *data) return -1; } - ptr1 = ast_strdupa(data); - - if (!ptr1) { - ast_log(LOG_ERROR, "Out of Memory!\n"); - return -1; - } + ptr2 = ptr1 = ast_strdupa(data); - ptr2 = ptr1; /* Separate the Application data ptr1 is the time spec ptr2 is the app|data */ strsep(&ptr2,"?"); - if(!ast_build_timing(&timing, ptr1)) { + if (!ast_build_timing(&timing, ptr1)) { ast_log(LOG_WARNING, "Invalid Time Spec: %s\nCorrect usage: %s\n", ptr1, usage); res = -1; } @@ -6004,8 +5983,7 @@ int ast_parseable_goto(struct ast_channel *chan, const char *goto_string) ast_log(LOG_WARNING, "Goto requires an argument (optional context|optional extension|priority)\n"); return -1; } - s = ast_strdupa(goto_string); - stringp=s; + stringp = s = ast_strdupa(goto_string); context = strsep(&stringp, "|"); exten = strsep(&stringp, "|"); if (!exten) { |