summaryrefslogtreecommitdiff
path: root/pbx.c
diff options
context:
space:
mode:
authorTilghman Lesher <tilghman@meg.abyt.es>2005-12-03 19:25:33 +0000
committerTilghman Lesher <tilghman@meg.abyt.es>2005-12-03 19:25:33 +0000
commit870f98f02de56e35b87f511544a6cda3d4d8fe69 (patch)
treef1b09ce6fd8d356c12bfe4e6b4e24e8f97ef1154 /pbx.c
parent6a6b88c0e33e0e60dbf8039d24d2e8815d194cae (diff)
Bug 5858 - Make the chanvars.c functions return a 'const char *'
This should prevent us from unintentionally changing variable values when they're returned from pbx_builtin_getvar_helper. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@7304 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'pbx.c')
-rw-r--r--pbx.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/pbx.c b/pbx.c
index 8ba552def..f437b27a7 100644
--- a/pbx.c
+++ b/pbx.c
@@ -1129,9 +1129,9 @@ icky:
ast_log(LOG_WARNING,"Comparing variable '%s' with '%s'\n",var,ast_var_name(variables));
#endif
if (strcasecmp(ast_var_name(variables),var)==0) {
- *ret=ast_var_value(variables);
- if (*ret) {
- ast_copy_string(workspace, *ret, workspacelen);
+ const char *s = ast_var_value(variables);
+ if (s) {
+ ast_copy_string(workspace, s, workspacelen);
*ret = workspace;
}
break;
@@ -1145,9 +1145,9 @@ icky:
ast_log(LOG_WARNING,"Comparing variable '%s' with '%s'\n",var,ast_var_name(variables));
#endif
if (strcasecmp(ast_var_name(variables),var)==0) {
- *ret = ast_var_value(variables);
- if (*ret) {
- ast_copy_string(workspace, *ret, workspacelen);
+ const char *s = ast_var_value(variables);
+ if (s) {
+ ast_copy_string(workspace, s, workspacelen);
*ret = workspace;
}
}
@@ -2413,7 +2413,7 @@ static int __ast_pbx_run(struct ast_channel *c)
ast_cdr_update(c);
}
} else {
- char *status;
+ const char *status;
status = pbx_builtin_getvar_helper(c, "DIALSTATUS");
if (!status)
@@ -5846,7 +5846,7 @@ static int pbx_builtin_goto(struct ast_channel *chan, void *data)
int pbx_builtin_serialize_variables(struct ast_channel *chan, char *buf, size_t size)
{
struct ast_var_t *variables;
- char *var, *val;
+ const char *var, *val;
int total = 0;
if (!chan)
@@ -5870,7 +5870,7 @@ int pbx_builtin_serialize_variables(struct ast_channel *chan, char *buf, size_t
return total;
}
-char *pbx_builtin_getvar_helper(struct ast_channel *chan, const char *name)
+const char *pbx_builtin_getvar_helper(struct ast_channel *chan, const char *name)
{
struct ast_var_t *variables;
struct varshead *headp;
@@ -6383,7 +6383,7 @@ int ast_context_verify_includes(struct ast_context *con)
}
-static int __ast_goto_if_exists(struct ast_channel *chan, char *context, char *exten, int priority, int async)
+static int __ast_goto_if_exists(struct ast_channel *chan, const char *context, const char *exten, int priority, int async)
{
int (*goto_func)(struct ast_channel *chan, const char *context, const char *exten, int priority);
@@ -6400,11 +6400,11 @@ static int __ast_goto_if_exists(struct ast_channel *chan, char *context, char *e
return -3;
}
-int ast_goto_if_exists(struct ast_channel *chan, char* context, char *exten, int priority) {
+int ast_goto_if_exists(struct ast_channel *chan, const char* context, const char *exten, int priority) {
return __ast_goto_if_exists(chan, context, exten, priority, 0);
}
-int ast_async_goto_if_exists(struct ast_channel *chan, char* context, char *exten, int priority) {
+int ast_async_goto_if_exists(struct ast_channel *chan, const char * context, const char *exten, int priority) {
return __ast_goto_if_exists(chan, context, exten, priority, 1);
}