aboutsummaryrefslogtreecommitdiffstats
path: root/pbx.c
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2005-10-18 19:16:13 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2005-10-18 19:16:13 +0000
commitadd0106fc48313fe3a9d95d96d48a9376d558647 (patch)
tree96dc96a769c380cb645d9d315ded4d17b561c52f /pbx.c
parente9de686a670901655b33b5dc68eab92922a22e8e (diff)
The amazing disappearing and reappearing patch... This time with documentation explaining it.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@6821 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'pbx.c')
-rwxr-xr-xpbx.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/pbx.c b/pbx.c
index e1eb1894d..da7d5be60 100755
--- a/pbx.c
+++ b/pbx.c
@@ -5885,14 +5885,22 @@ void pbx_builtin_setvar_helper(struct ast_channel *chan, const char *name, const
{
struct ast_var_t *newvariable;
struct varshead *headp;
+ const char *nametail = name;
if (name[strlen(name)-1] == ')')
return ast_func_write(chan, name, value);
headp = (chan) ? &chan->varshead : &globals;
+ /* For comparison purposes, we have to strip leading underscores */
+ if (*nametail == '_') {
+ nametail++;
+ if (*nametail == '_')
+ nametail++;
+ }
+
AST_LIST_TRAVERSE (headp, newvariable, entries) {
- if (strcasecmp(ast_var_name(newvariable), name) == 0) {
+ if (strcasecmp(ast_var_name(newvariable), nametail) == 0) {
/* there is already such a variable, delete it */
AST_LIST_REMOVE(headp, newvariable, entries);
ast_var_delete(newvariable);