From d99b677f3501944b7aaf82375ef62a88e5fa3933 Mon Sep 17 00:00:00 2001 From: russell Date: Wed, 10 May 2006 13:22:15 +0000 Subject: 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 --- res/res_monitor.c | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) (limited to 'res/res_monitor.c') 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; -- cgit v1.2.3