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_features.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_features.c')
-rw-r--r-- | res/res_features.c | 61 |
1 files changed, 29 insertions, 32 deletions
diff --git a/res/res_features.c b/res/res_features.c index b8c1cfe5b..c5dfbcfa6 100644 --- a/res/res_features.c +++ b/res/res_features.c @@ -174,26 +174,33 @@ static void check_goto_on_transfer(struct ast_channel *chan) char *x, *goto_on_transfer; struct ast_frame *f; - if (!ast_strlen_zero(val) && (goto_on_transfer = ast_strdupa(val)) && (xferchan = ast_channel_alloc(0))) { - for (x = goto_on_transfer; x && *x; x++) - if (*x == '^') - *x = '|'; - ast_string_field_set(xferchan, name, chan->name); - /* Make formats okay */ - xferchan->readformat = chan->readformat; - xferchan->writeformat = chan->writeformat; - ast_channel_masquerade(xferchan, chan); - ast_parseable_goto(xferchan, goto_on_transfer); - xferchan->_state = AST_STATE_UP; - ast_clear_flag(xferchan, AST_FLAGS_ALL); - xferchan->_softhangup = 0; - if ((f = ast_read(xferchan))) { - ast_frfree(f); - f = NULL; - ast_pbx_start(xferchan); - } else { - ast_hangup(xferchan); - } + if (ast_strlen_zero(val)) + return; + + goto_on_transfer = ast_strdupa(val); + + if (!(xferchan = ast_channel_alloc(0))) + return; + + for (x = goto_on_transfer; x && *x; x++) { + if (*x == '^') + *x = '|'; + } + ast_string_field_set(xferchan, name, chan->name); + /* Make formats okay */ + xferchan->readformat = chan->readformat; + xferchan->writeformat = chan->writeformat; + ast_channel_masquerade(xferchan, chan); + ast_parseable_goto(xferchan, goto_on_transfer); + xferchan->_state = AST_STATE_UP; + ast_clear_flag(xferchan, AST_FLAGS_ALL); + xferchan->_softhangup = 0; + if ((f = ast_read(xferchan))) { + ast_frfree(f); + f = NULL; + ast_pbx_start(xferchan); + } else { + ast_hangup(xferchan); } } @@ -920,9 +927,6 @@ static int ast_feature_interpret(struct ast_channel *chan, struct ast_channel *p char *tmp = ast_strdupa(dynamic_features); char *tok; - if (!tmp) - return res; - while ((tok = strsep(&tmp, "#")) != NULL) { feature = find_feature(tok); @@ -966,11 +970,8 @@ static void set_config_flags(struct ast_channel *chan, struct ast_channel *peer, char *tok; struct ast_call_feature *feature; - if (!tmp) /* no memory */ - return; - /* while we have a feature */ - while (NULL != (tok = strsep(&tmp, "#"))) { + while ((tok = strsep(&tmp, "#"))) { if ((feature = find_feature(tok)) && ast_test_flag(feature, AST_FEATURE_FLAG_NEEDSDTMF)) { if (ast_test_flag(feature, AST_FEATURE_FLAG_CALLER)) ast_set_flag(config, AST_BRIDGE_DTMF_CHANNEL_0); @@ -1191,11 +1192,7 @@ int ast_bridge_call(struct ast_channel *chan,struct ast_channel *peer,struct ast src = peer; if (monitor_app && src) { char *tmp = ast_strdupa(monitor_exec); - if (tmp) { - pbx_exec(src, monitor_app, tmp); - } else { - ast_log(LOG_ERROR, "Monitor failed: out of memory\n"); - } + pbx_exec(src, monitor_app, tmp); } } |