diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-12-03 19:25:33 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-12-03 19:25:33 +0000 |
commit | 3365b1cc9fd629381e341c2291fc0cfb53a44c36 (patch) | |
tree | f1b09ce6fd8d356c12bfe4e6b4e24e8f97ef1154 /pbx.c | |
parent | a3c74f33dd6c999b8db1cd4281784753ebca997d (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: http://svn.digium.com/svn/asterisk/trunk@7304 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'pbx.c')
-rw-r--r-- | pbx.c | 24 |
1 files changed, 12 insertions, 12 deletions
@@ -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); } |