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 /res/res_monitor.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 'res/res_monitor.c')
-rw-r--r-- | res/res_monitor.c | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/res/res_monitor.c b/res/res_monitor.c index 4f47a6512..23b2ed5ba 100644 --- a/res/res_monitor.c +++ b/res/res_monitor.c @@ -172,17 +172,13 @@ int ast_monitor_start( struct ast_channel *chan, const char *format_spec, seq++; ast_mutex_unlock(&monitorlock); - if((channel_name = ast_strdupa(chan->name))) { - while((p = strchr(channel_name, '/'))) { - *p = '-'; - } - snprintf(monitor->filename_base, FILENAME_MAX, "%s/%d-%s", - ast_config_AST_MONITOR_DIR, (int)time(NULL),channel_name); - monitor->filename_changed = 1; - } else { - ast_log(LOG_ERROR,"Failed to allocate Memory\n"); - return -1; + channel_name = ast_strdupa(chan->name); + while ((p = strchr(channel_name, '/'))) { + *p = '-'; } + snprintf(monitor->filename_base, FILENAME_MAX, "%s/%d-%s", + ast_config_AST_MONITOR_DIR, (int)time(NULL), channel_name); + monitor->filename_changed = 1; } monitor->stop = ast_monitor_stop; @@ -416,15 +412,13 @@ static int start_monitor_exec(struct ast_channel *chan, void *data) the following could give NULL results, but we check just to be pedantic. Reconstructing with checks for 'm' option does not work if we end up adding more options than 'm' in the future. */ - delay = ast_strdupa((char*)data); - if (delay) { - options = strrchr(delay, '|'); - if (options) { - arg = strchr(options, 'b'); - if (arg) { - *arg = 'X'; - pbx_builtin_setvar_helper(chan,"AUTO_MONITOR",delay); - } + delay = ast_strdupa(data); + options = strrchr(delay, '|'); + if (options) { + arg = strchr(options, 'b'); + if (arg) { + *arg = 'X'; + pbx_builtin_setvar_helper(chan,"AUTO_MONITOR",delay); } } return 0; |