summaryrefslogtreecommitdiff
path: root/res/res_monitor.c
diff options
context:
space:
mode:
authorRussell Bryant <russell@russellbryant.com>2006-05-10 13:22:15 +0000
committerRussell Bryant <russell@russellbryant.com>2006-05-10 13:22:15 +0000
commit04ecb29d03ed942e53917974b8d8580b5341b42e (patch)
tree167bf7a9b6b330883dc9bf865672132658710ffd /res/res_monitor.c
parent8e897e1a531bb1d63a7c53bd367e97e8b2fa0952 (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: https://origsvn.digium.com/svn/asterisk/trunk@26451 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_monitor.c')
-rw-r--r--res/res_monitor.c32
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;