summaryrefslogtreecommitdiff
path: root/res
diff options
context:
space:
mode:
Diffstat (limited to 'res')
-rw-r--r--res/res_agi.c2
-rw-r--r--res/res_clioriginate.c9
-rw-r--r--res/res_config_odbc.c2
-rw-r--r--res/res_config_pgsql.c2
-rw-r--r--res/res_convert.c4
-rw-r--r--res/res_features.c61
-rw-r--r--res/res_monitor.c32
7 files changed, 49 insertions, 63 deletions
diff --git a/res/res_agi.c b/res/res_agi.c
index c4df2421e..d1218e288 100644
--- a/res/res_agi.c
+++ b/res/res_agi.c
@@ -138,8 +138,6 @@ static int launch_netscript(char *agiurl, char *argv[], int *fds, int *efd, int
/* agiusl is "agi://host.domain[:port][/script/name]" */
host = ast_strdupa(agiurl + 6); /* Remove agi:// */
- if (!host)
- return -1;
/* Strip off any script name */
if ((c = strchr(host, '/'))) {
*c = '\0';
diff --git a/res/res_clioriginate.c b/res/res_clioriginate.c
index 1c02491d2..306975946 100644
--- a/res/res_clioriginate.c
+++ b/res/res_clioriginate.c
@@ -76,8 +76,7 @@ static int orig_app(int fd, const char *chan, const char *app, const char *appda
if (ast_strlen_zero(app))
return RESULT_SHOWUSAGE;
- if (!(chandata = ast_strdupa(chan)))
- return RESULT_FAILURE;
+ chandata = ast_strdupa(chan);
chantech = strsep(&chandata, "/");
if (!chandata) {
@@ -98,8 +97,7 @@ static int orig_exten(int fd, const char *chan, const char *data)
char *context = NULL;
int reason = 0;
- if (!(chandata = ast_strdupa(chan)))
- return RESULT_FAILURE;
+ chandata = ast_strdupa(chan);
chantech = strsep(&chandata, "/");
if (!chandata) {
@@ -108,8 +106,7 @@ static int orig_exten(int fd, const char *chan, const char *data)
}
if (!ast_strlen_zero(data)) {
- if (!(context = ast_strdupa(data)))
- return RESULT_FAILURE;
+ context = ast_strdupa(data);
exten = strsep(&context, "@");
}
diff --git a/res/res_config_odbc.c b/res/res_config_odbc.c
index 31a2d1513..0929f741c 100644
--- a/res/res_config_odbc.c
+++ b/res/res_config_odbc.c
@@ -252,7 +252,7 @@ static struct ast_config *realtime_multi_odbc(const char *database, const char *
return NULL;
}
initfield = ast_strdupa(newparam);
- if (initfield && (op = strchr(initfield, ' ')))
+ if ((op = strchr(initfield, ' ')))
*op = '\0';
newval = va_arg(aq, const char *);
if (!strchr(newparam, ' ')) op = " ="; else op = "";
diff --git a/res/res_config_pgsql.c b/res/res_config_pgsql.c
index 97d493456..2e900d00d 100644
--- a/res/res_config_pgsql.c
+++ b/res/res_config_pgsql.c
@@ -239,7 +239,7 @@ static struct ast_config *realtime_multi_pgsql(const char *database, const char
}
initfield = ast_strdupa(newparam);
- if (initfield && (op = strchr(initfield, ' '))) {
+ if ((op = strchr(initfield, ' '))) {
*op = '\0';
}
diff --git a/res/res_convert.c b/res/res_convert.c
index 553075874..85bc7d2da 100644
--- a/res/res_convert.c
+++ b/res/res_convert.c
@@ -72,8 +72,8 @@ static int cli_audio_convert(int fd, int argc, char *argv[])
goto fail_out;
}
- if (!(file_in = ast_strdupa(argv[1])) || !(file_out = ast_strdupa(argv[2])))
- goto fail_out;
+ file_in = ast_strdupa(argv[1]);
+ file_out = ast_strdupa(argv[2]);
if (split_ext(file_in, &name_in, &ext_in)) {
ast_cli(fd, "'%s' is an invalid filename!\n", argv[1]);
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);
}
}
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;